Add two script commands to the same HREF

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wolfman
    New Member
    • Apr 2007
    • 21

    Add two script commands to the same HREF

    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="javascrip t:newWindow4('p lay/ep01a.html')" onMouseOver="wi ndow.status='po pup'; return true" onMouseOut="win dow.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="javascrip t:newWindow4('p lay/ep01a.html')" onClick="locati on.href='ep01.h tml'" onMouseOver="wi ndow.status='po pup'; return true" onMouseOut="win dow.status=''; return true">

    <A HREF="javascrip t:newWindow4('p lay/ep01a.html');window.locatio n = "ep01.html"" STYLE="text-decoration: none" onMouseOver="wi ndow.status='po pup'; return true" onMouseOut="win dow.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
  • Logician
    New Member
    • Feb 2007
    • 210

    #2
    Originally posted by Wolfman
    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.

    Code:
    <a href='#' onclick='window.open("http://google.com","xxx","width=300,height=300");location.href="http://youtube.com"'>GO</a>

    Comment

    • Wolfman
      New Member
      • Apr 2007
      • 21

      #3
      Thanks much! I was able to succesfully combine the existing script with your syntax to result in the following line:

      <A HREF="javascrip t:newWindow4('p lay/ep01a.html');lo cation.href='ep 01.html'" onMouseOver="wi ndow.status='po pup'; return true" onMouseOut="win dow.status=''; return true">

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

      Wolfman

      Comment

      Working...