Javascript window.opener
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=20757
Printed Date: 30 March 2026 at 7:51am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: Javascript window.opener
Posted By: VBScript
Subject: Javascript window.opener
Date Posted: 20 July 2006 at 5:27pm
I have a pop-up window and by using javascript I want to use the window.opener function to change the URL of the page that opened it.
How would I go about doing this?
------------- http://www.james-r.co.uk" rel="no follow - James
http://www.gotrillian.com/?4498-20" rel="no follow - Trillian - M
|
Replies:
Posted By: aks427
Date Posted: 20 July 2006 at 7:40pm
window.opener.location="url"; |
|
Posted By: VBScript
Date Posted: 20 July 2006 at 8:11pm
Thanks!
------------- http://www.james-r.co.uk" rel="no follow - James
http://www.gotrillian.com/?4498-20" rel="no follow - Trillian - M
|
Posted By: skwfalcon16
Date Posted: 28 July 2006 at 7:36am
So I'm using the old javascript pop-up window code that WWF use to use:
Javascript Code:
//Function to open pop up window function openWin(theURL,winName,features) { window.open(theURL,winName,features); }
ASP Code:
Response.Write (" <a href=""javascript:openWin('/dsp/includes/pop_up_event.asp?ID=" & rsEvent("Event_ID") & "','" & rsEvent("Event_Title") & "','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=600,height=400')"">")
|
It works just fine in FF, but throws an error in IE and won't open. I thought it might be pop-up blocker or something, but that didn't help.
Any ideas?
------------- http://www.spreadfirefox.com/?q=affiliates&id=179077&t=82">
|
Posted By: aks427
Date Posted: 28 July 2006 at 3:18pm
|
What is the error, and can you post the code that is actually outputted, instead of the ASP?
|
Posted By: skwfalcon16
Date Posted: 28 July 2006 at 7:28pm
My bad. Here is what the HTML looks like:
From FF: <a href="javascript:openWin('/dsp/includes/pop_up_event.asp?ID=14','Prospect Social','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=600,height=400')">Prospect Social</a>
From IE: <a href="javascript:openWin('/dsp/includes/pop_up_event.asp?ID=14','Prospect Social','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=600,height=400')">Prospect Social</a>
And the Javascript just for reference: //Function to open pop up window function openWin(theURL,winName,features) { window.open(theURL,winName,features); }
|
The error that is says is Line: 4 Character: 4 Error: "invalid argument" Code: 0
Here is the top 4 lines of the page too, but I don't think that has anything to do with it:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
And the open window function is the first one in my included javascript file, so I'm not real sure where the Line 4, Character 4 issue is.
This one has me stumped...so odds are it's fairly simple.
------------- http://www.spreadfirefox.com/?q=affiliates&id=179077&t=82">
|
Posted By: aks427
Date Posted: 28 July 2006 at 8:05pm
|
Your problem is coming in the new window's name. Firefox can accept a space, but IE can't.
For the name, do something like this instead.
Replace(rsEvent("Event_Title")," ","") |
|
Posted By: skwfalcon16
Date Posted: 28 July 2006 at 8:08pm
Awesome!
Thank you!
(I knew it would be something simple...which is why I missed it)
------------- http://www.spreadfirefox.com/?q=affiliates&id=179077&t=82">
|
|