A reader asked if she can make a navigation 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 come here trying to find out how 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>:
When clicked, this code will open YOUR_URL in a new window. To add another link, just add the code below before “>” in the opening tag:
It will open YOUR_2nd_URL in a second new window. To add more links, simply add more
So if you were to open three links, your anchor will look like this:
<a href="YOUR_URL" target="_blank" onclick="window.open(""YOUR_2nd_URL""); window.open(""YOUR_3rd_URL"");">Link text</a>
(Now if you come here trying to find out how 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>:
<
a
href
=
"YOUR_URL"
target
=
"_blank"
>Link text</
a
>
When clicked, this code will open YOUR_URL in a new window. To add another link, just add the code below before “>” in the opening tag:
onclick="window.open("YOUR_2nd_URL");"
It will open YOUR_2nd_URL in a second new window. 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:
<a href="YOUR_URL" target="_blank" onclick="window.open(""YOUR_2nd_URL""); window.open(""YOUR_3rd_URL"");">Link text</a>
No comments:
Post a Comment