|
Posted by jojo on 11/26/74 11:53
crazyjxx@gmail.com schrieb:
> I have been trying to create my own webpage and I am wondering if there
> is a way to create a link on my webpage that sends the person to
> multiple urls in new windows. For example if they click on a link on
> my page "Cnn and Yahoo" it will open two seperate pages in new windows
> Cnn.com and yahoo.com. I have been using a html edditor to create my
> page so the html code to be able to do this would be greatly
> appreciated.
>
> Thanks alot
>
Yes, it is possible, but it is not with pure HTML. You need to use
JavaScript here. The problem is that many users do not have JS enabled
for security reasons, so /they/ might not be able to use those links. A
possibility might be to use two links and delete one with JS and modify
the other. That would ensure that users with JS switched off still view
all linked pages.
To realize that you have to put the following code into the <head> of
your page:
<script language="javascript" type="script/javascript">
document.getElementById("link2").style.display="none"
document.getElementById("link1").innerHTML="Yahoo and CNN"
function doubleLink(page){
win=window.open()
win.location.href=page
}
</script>
Your links have to look like this:
<a href="www.yahoo.com" target="_blank" id="link1"
onclick="doubleLink('www.cnn.com')">Yahoo</a>
<a href="www.cnn.com" target="_blank" id="link2">CNN</a>
HTH,
jojo
Navigation:
[Reply to this message]
|