469,645 Members | 1,595 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Add two script commands to the same HREF

21
Hi guys

I recently added a popup HREF script to a page, but I'd also like to make the page itself change when the HREF command is clicked. When the user clicks, not only would the popup window appear, but the originating page would change to another as well.

I thought it'd be a rather straightforward proposition, but I can't seem to get the syntax right. I tried using onClick and adding the second command after a semicolon, neither of which worked.

First, here's the HREF as it now appears:
<A HREF="javascript:newWindow4('play/ep01a.html')" onMouseOver="window.status='popup'; return true" onMouseOut="window.status=''; return true">

You'll notice that it calls an external script variable (newWindow4) which defines the nature of the popup.

Here are a couple of things I unsuccessfully tried to make the page change as well:
<A HREF="javascript:newWindow4('play/ep01a.html')" onClick="location.href='ep01.html'" onMouseOver="window.status='popup'; return true" onMouseOut="window.status=''; return true">

<A HREF="javascript:newWindow4('play/ep01a.html');window.location = "ep01.html"" STYLE="text-decoration: none" onMouseOver="window.status='popup'; return true" onMouseOut="window.status=''; return true">

Neither allows even the original script to run.

Basically, here' what I want it to do:
run newWindow4
change page to ep01.html

Any idea how I can make this link work?

Wolfman
Dec 8 '07 #1
2 2601
Logician
210 100+
Hi guys

I recently added a popup HREF script to a page, but I'd also like to make the page itself change when the HREF command is clicked. When the user clicks, not only would the popup window appear, but the originating page would change to another as well.
No matter how often you see it, script does not belong in the HREF parameter.

Expand|Select|Wrap|Line Numbers
  1. <a href='#' onclick='window.open("http://google.com","xxx","width=300,height=300");location.href="http://youtube.com"'>GO</a>
  2.  
Dec 9 '07 #2
Wolfman
21
Thanks much! I was able to succesfully combine the existing script with your syntax to result in the following line:

<A HREF="javascript:newWindow4('play/ep01a.html');location.href='ep01.html'" onMouseOver="window.status='popup'; return true" onMouseOut="window.status=''; return true">

It worked like a charm and allowed me to avoid a page refresh.

Wolfman
Dec 10 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.