+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: JavaScript: Opening 2 links with 1 Click

  1. #1
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    100

    JavaScript: Opening 2 links with 1 Click

    Introduction:-
    Well here I will show you how to open 2 links with just one click.

    Solution:-

    Here is the Code, insert this in the Head:-

    Code:
    <SCRIPT LANGUAGE="JavaScript"> 
    
    function DoubleOpen(site1, site2) { 
    window.open(site1); 
    window.location = site2; 
    } 
    </script>
    and this goes into the body

    Code:
    <a href="javascript:DoubleOpen('site1', 'site2');">Click Here</a>
    Example:-
    Code:
    <a href="javascript:DoubleOpen('http://www.codecall.net/', 'http://forum.codecall.net/');">Click Here</a>
    Conclusion:-
    As Always The Full Code Is Attached And Feedback Is Welcome!
    Attached Files Attached Files

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    xtraze is offline Programming God
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    911
    Rep Power
    0
    Nice, I think I will try to use this for IPB and make another window oen requesting unregistered members to sign-up.

  4. #3
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    100
    Quote Originally Posted by xtraze View Post
    Nice, I think I will try to use this for IPB and make another window oen requesting unregistered members to sign-up.
    I'm happy that you found a use for this

  5. #4
    xtraze is offline Programming God
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    911
    Rep Power
    0
    I always think of uses for tutorials being posted here. I may not use all but maybe someone else can. Look at all replies I have made dude, most of them are alternates or uses.

  6. #5
    AfTriX is offline Programming God
    Join Date
    Jan 2007
    Location
    Chicago
    Posts
    586
    Rep Power
    0
    Thanks!
    Nice trick of parsing a couple of arguments to the function.

    Code:
    windows.location = xxx;
    The code that I'v learnt now.

  7. #6
    TheJun is offline Newbie
    Join Date
    Aug 2007
    Posts
    1
    Rep Power
    0
    Thank you very much.

  8. #7
    broomy is offline Newbie
    Join Date
    Oct 2011
    Posts
    2
    Rep Power
    0

    Re: JavaScript: Opening 2 links with 1 Click

    I used this code:

    HTML Code:
    <head>
    <SCRIPT LANGUAGE="JavaScript"> 
    
    function DoubleOpen(site1, site2) { 
    window.open(site1); 
    window.location = site2; 
    } 
    </script> 
    </head>
    
    <body>
    <a href="http://stats.justhost.com/track?c4d46e520aad528107f000dfd9c8d553d/', 'http://thepiratebay.org/torrent/6562848/');">Click Here</a> 
    </body>
    but it didn't work, please help what have i done wrong?

  9. #8
    Join Date
    Jul 2006
    Posts
    16,448
    Blog Entries
    74
    Rep Power
    143

    Re: JavaScript: Opening 2 links with 1 Click

    You are trying to open two links in the CURRENT window. That's just not possible. Try setting the target to new.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  10. #9
    broomy is offline Newbie
    Join Date
    Oct 2011
    Posts
    2
    Rep Power
    0

    Exclamation Re: JavaScript: Opening 2 links with 1 Click

    Quote Originally Posted by WingedPanther View Post
    You are trying to open two links in the CURRENT window. That's just not possible. Try setting the target to new.
    Not trying to sound dum or anything, but i'm new to HTML just trying to learn a few useful tricks. But how to you change the target to new window?

  11. #10
    Join Date
    Jul 2006
    Posts
    16,448
    Blog Entries
    74
    Rep Power
    143

    Re: JavaScript: Opening 2 links with 1 Click

    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

+ Reply to Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Javascript: Opening 2 (or more) links with 1 Click
    By TcM in forum JavaScript Tutorials
    Replies: 7
    Last Post: 11-16-2010, 11:53 PM
  2. [Javascript] Simple click indentation question
    By HumansAreFriendsNotFood in forum JavaScript and CSS
    Replies: 2
    Last Post: 09-24-2010, 10:46 PM
  3. Anyone Know How to Click A Button Using Javascript?
    By tradingjamie in forum JavaScript and CSS
    Replies: 1
    Last Post: 11-18-2009, 05:17 PM
  4. Adding bottom links with click-over feature? Help please!
    By Panarchy in forum JavaScript and CSS
    Replies: 98
    Last Post: 01-18-2009, 04:03 AM
  5. Do you click links in member signatures?
    By marwex89 in forum The Lounge
    Replies: 21
    Last Post: 10-01-2008, 09:45 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts