Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
function callpopup()
{
    var popUrl = "frmPopUp.aspx";
    var name = "popUp";
    var appearence="dependent=yes,menubar=no,resizable=no,status=no,toolbar=no,titlebar=no,left=5,top=280,width=230px,height=140px";
    var openWindow = window.open(popUrl,name,appearence);
    openWindow.focus();//Error:Microsoft JScript runtime error: 'null' is null or not an object

}

code behind :
protected void btnPopUp_Click(object sender, EventArgs e)
    {
        ClientScript.RegisterStartupScript(GetType(), "Javascript","javascript:callpopup();", true);
    }
Posted
Updated 17-Mar-11 21:15pm
v3
Comments
Ankur\m/ 18-Mar-11 3:16am    
Edit: Added proper tags to the question.
Albin Abel 18-Mar-11 4:01am    
Your code working fine for me and get back the window object. So issues would be browser compatibility.

//Error:Microsoft JScript runtime error: 'null' is null or not an object
Error is self explanatory. You have tried to open a new window but the paramters were not provided properly.

Here you go and see all about Window.Open[^] method.
 
Share this answer
 
Comments
Espen Harlinn 18-Mar-11 5:11am    
Right, my 5
raju melveetilpurayil 18-Mar-11 9:13am    
good one, my 6 ;)
aftab5124 22-Mar-11 0:36am    
function callpopup()
{
var j;
j= showModalDialog("frmPopUp.aspx",window,"status:no;dialogWidth:400px;dialogHeight:350px;unadorned:yes;help:no");
}
Sandeep Mewara 22-Mar-11 1:34am    
Ok. Now you use showModalDialog. Further, the name given to it is a keyword 'window'. + I have no idea why you have posted this comment here!

For showmodalDialog, go here: http://msdn.microsoft.com/en-us/library/ms536759%28v=vs.85%29.aspx
You should give the full URL for this.
var popUrl = "www.domainname.com/frmPopUp.aspx"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900