Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Javascript: Opening 2 (or more) links with 1 Click


  • Please log in to reply
7 replies to this topic

#1 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 06 January 2007 - 06:38 AM

Introduction:-
Here I will show you how to open one, two, three, four etc... links with one click!

Let's Code:-
Make this code between the HEAD tags:-

<script language="javascript">

function OpenAllLinks() {
window.open("http://www.site1.com")
window.open("http://www.site2.com")
window.open("http://www.site3.com")
window.open("http://www.site4.com")
window.open("http://www.site5.com")
window.open("http://www.site6.com")
}

</script>

and this into the BODY tags:-
<a href="javascript:OpenAllLinks()">Open the links</a>

Explanation:-

function OpenAllLinks() {
window.open("http://www.site1.com")
window.open("http://www.site2.com")
window.open("http://www.site3.com")
window.open("http://www.site4.com")
window.open("http://www.site5.com")
window.open("http://www.site6.com")
}

Here you can include all your links!

Conclusion:-
Source code is attached, and feedback welcome

Attached Files


  • 0

#2 Guest_Jaan_*

Guest_Jaan_*
  • Guest

Posted 06 January 2007 - 07:30 AM

lol great trick ;) good job
  • 0

#3 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 06 January 2007 - 09:38 AM

Thanks welcome ;)
  • 0

#4 xtraze

xtraze

    CC Devotee

  • Just Joined
  • PipPipPipPipPipPip
  • 872 posts

Posted 06 January 2007 - 06:23 PM

But are these opened as popups, as people (including myself) block them lol.
And maybe a bug can be created by this. can make people without tabbed browsing mad., lol. Just a joke. Read again if you can't understand.
  • 0

#5 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 07 January 2007 - 01:29 AM

Yes I understood! Something like Internet Explorer 6 rotfl, well but there may be more useful way of utilizing this ;)
  • 0

#6 xtraze

xtraze

    CC Devotee

  • Just Joined
  • PipPipPipPipPipPip
  • 872 posts

Posted 07 January 2007 - 11:49 PM

The thing I mentioned is complete useless, lol. It's just a joke to make the Browser or maybe the whole Computer Crash. Maybe this can be used when some one want 3-5 different files to be downloaded, if those files are available somwhere, we can have use of this script if we don't like to re-upload those files in our web server.

I know this is not needed, but I think if we did find a need of this, we may come to codecall.
  • 0

#7 AfTriX

AfTriX

    CC Devotee

  • Just Joined
  • PipPipPipPipPipPip
  • 541 posts

Posted 12 January 2007 - 01:26 AM

Nice work with the Function, we can use to pop-up something when the user clicks download or something..

Simply Cool..
  • 0

#8 bbqroast

bbqroast

    Codecall Addict

  • Senior Member
  • PipPipPipPipPipPip
  • 564 posts
  • Location:/etc/passwd

Posted 16 November 2010 - 11:53 PM

This would be good if one link was a file and the other to a thanks for downloading page (with links to tuts and other related stuff).
Seeing as most browsers don't see files as popups this would be fine
  • 0
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download