Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Javascript window.opener
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Javascript window.opener

 Post Reply Post Reply
Author
VBScript View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2004
Location: United Kingdom
Status: Offline
Points: 219
Post Options Post Options   Thanks (0) Thanks(0)   Quote VBScript Quote  Post ReplyReply Direct Link To This Post Topic: Javascript window.opener
    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?
Back to Top
aks427 View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 06 December 2003
Location: United States
Status: Offline
Points: 276
Post Options Post Options   Thanks (0) Thanks(0)   Quote aks427 Quote  Post ReplyReply Direct Link To This Post Posted: 20 July 2006 at 7:40pm
window.opener.location="url";
Back to Top
VBScript View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2004
Location: United Kingdom
Status: Offline
Points: 219
Post Options Post Options   Thanks (0) Thanks(0)   Quote VBScript Quote  Post ReplyReply Direct Link To This Post Posted: 20 July 2006 at 8:11pm
Thanks! 
Back to Top
skwfalcon16 View Drop Down
Groupie
Groupie


Joined: 07 November 2004
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote skwfalcon16 Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
aks427 View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 06 December 2003
Location: United States
Status: Offline
Points: 276
Post Options Post Options   Thanks (0) Thanks(0)   Quote aks427 Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
skwfalcon16 View Drop Down
Groupie
Groupie


Joined: 07 November 2004
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote skwfalcon16 Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
aks427 View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 06 December 2003
Location: United States
Status: Offline
Points: 276
Post Options Post Options   Thanks (0) Thanks(0)   Quote aks427 Quote  Post ReplyReply Direct Link To This Post 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")," ","")


Edited by aks427 - 28 July 2006 at 8:06pm
Back to Top
skwfalcon16 View Drop Down
Groupie
Groupie


Joined: 07 November 2004
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote skwfalcon16 Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2006 at 8:08pm
Awesome!

Thank you!

(I knew it would be something simple...which is why I missed it)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.