Monday, November 4

on Leave a Comment

Multiple links Open


Multiple links Open 


A reader asked if she can make anavigation tab open more than one link when clicked. The answer is YES it can be done, with the help from a small Javascript.
(Now if you came here looking for a way YOU can open multiple links on pages you visit, try Snap Links, a  Firefox addon.)



First let’s look at an HTML code for a regular anchor tag <a>:
Eg:   <a href="YOUR_URL" target="_blank">Link text</a>

When clicked, this code will open YOUR_URL in a new window/tab.
To add another link, just add the code below before the closing bracket “>” in the opening tag:
Eg:  onclick="window.open(&quot;YOUR_2nd_URL&quot;);"

It will open YOUR_2nd_URL in a second new window/tab. To add more links, simply add more window.open(); before the closing quotation mark.
So if you were to open three links, your anchor will look like this:
Eg:       <a href="YOUR_URL" target="_blank"
      onclick="window.open(&quot;&quot;YOUR_2nd_URL&quot;&quot;); 
     window.open(&quot;&quot;YOUR_3rd_URL&quot;&quot;);">Link 
     text</a>

This is an example of an anchor that opens three links (in three windows or tabs) in a single click:
 Eg :  <a href="http://bloggersentral.blogspot.com/" target=
     onclick="window.open(&quot;http://www.tourism.gov.my/&quot;); 
     window.open(&quot;http://www.tic.kelantan.gov.my/&quot;);">This 
     anchor opens three links in a single click</a>


0 comments:

Post a Comment

Contact Form

Name

Email *

Message *