Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a JS function from a Popup

Status
Not open for further replies.

shweta

Technical User
Mar 20, 2001
27
US
Hi,

I'm hoping someone can help me with this.

I am opening a window, and based on certain actions within the window, I call a function within the 'opener' to submit the form. The code for the function looks something like this:


function loadOfficeID(vid,vName){
document.forms[0].OfficeID.value=vid
document.forms[0].action = "welcome.asp?action=select"
document.forms[0].submit()
}


Now, this code works perfectly fine in IE and NS6+. But in NS 4.76, I get an error

Illegal URL method 'welcome.asp?action=select'

And it happens only when I call this function from a different window.

Any ideas?!

Thanks!

 
I agree that you shouldn't try too hard to support NS4.7.

However, since the code is in the popWindow, shouldn't your code look like this:

function loadOfficeID(vid,vName){
window.opener.forms[0].OfficeID.value=vid
window.opener.forms[0].action = "welcome.asp?action=select"
window.opener.forms[0].submit()
}

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Thanks... and I must admit at this point I am tempted to stop supporting NS altogether!

mwolf00,

I can't call the function from the popup because I load the popup from a lot of different pages so calling the loadOfficeID function in the opener allows me to do page specific processing.

I did find a solution. You have to qualify the page with " only for Netscape 4.76, as below:

if (!document.layers)
document.forms[0].action = "welcome.asp?action=select"
else
document.forms[0].action = &quot;<%= ServerName & Request.ServerVariables(&quot;SCRIPT_NAME&quot;)%>?action=select&quot;


I'm still hoping someone has a better idea, I would be glad to use it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top