PDA

View Full Version : html double link



Klinerr1
06-14-2002, 02:10 PM
in html can i make a link that sends two different urls to two different targets(iframes)

Commander
06-14-2002, 02:17 PM
do a search on www.htmlgoodies.com I saw one just the other day

Fordy
06-14-2002, 02:45 PM
With a little Javascript....



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>2 Jumps</title>
<script>
function YAGO(){
frame1.location.href="http://www.yahoo.com";
frame2.location.href="http://www.google.com";
}
function FDCP(){
frame1.location.href="http://www.cprogramming.com";
frame2.location.href="http://www.flashdaddee.com";
}
</script>
</head>

<body>
<iframe name="frame1" width="300" Height="300">
</iframe>
<iframe name="frame2" width="300" Height="300">
</iframe>
<br>
<a onClick="YAGO();" >Click here for Yahoo & Google</a>
<br>
<a onClick="FDCP();" >Click here for CProg & Flashdaddee</a>
</body>
</html>

Klinerr1
06-14-2002, 02:56 PM
is it possible so it (the javascript code) make it so when they put their mouse over the javascript link it turns into the hand poiting iwht its index finger like your mouse does when putting it over a normla html link

Fordy
06-14-2002, 03:36 PM
Hmm......probably a better method....but what I did below is add a normal hyperlink.......link that to one of the frames, and then added an extra event handler to set the location of the other frame...Ugly, but effective.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>2 Jumps</title>
<script>
function YAGO(){
frame2.location.href="http://www.google.com";
}
function FDCP(){
frame2.location.href="http://www.flashdaddee.com";
}
</script>
</head>

<body>
<iframe name="frame1" width="300" Height="300">
</iframe>
<iframe name="frame2" width="300" Height="300">
</iframe>
<br>
<a href="http://www.yahoo.com" onClick="YAGO();" target="frame1">
Click here for Yahoo & Google</a>
<br>
<a href="http://www.cprogramming.com" onClick="FDCP();" target="frame1">
Click here for CProg & Flashdaddee</a>
</body>
</html>

I tried it with dummy hyperlinks ( ala <a href="#" onClick="YAGO();">), this worked in Internet Explorer, but Opera ( my main browser) didnt like it...so I abandoned it