Jump to content

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

- - - - -

  • Please log in to reply
7 replies to this topic

#1
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
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



#2
Guest_Jaan_*

Guest_Jaan_*
  • Guests
lol great trick ;) good job

#3
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Thanks welcome ;)

#4
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
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.

#5
TcM

TcM

    Writes binary right handed and hex left handed

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

#6
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
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.

#7
AfTriX

AfTriX

    Programming God

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

Simply Cool..

#8
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
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
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).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users