PDA

View Full Version : One Anchor, Two Links in Two New Targets.


entimp
08-11-2003, 01:16 AM
Hi all. After some anchor code that will allow one anchor open in two new targeted frames. I can find code that will open two links, one in parent frame and one in a targeted frame.

I would like them to both open in 2 seperate targets. Hope it is possible.

I am sure it is but cant find anything despite exhaustive searches on here and elsewhere.

Thanks in advance.

scoutt
08-11-2003, 01:36 AM
javascript would be the only thing you could do. I can move this if that is the case.

pyrexyn
08-11-2003, 01:41 AM
Two targets in one window (frames)

<a href="urlone.html" target="targetone" onclick="openNew()">LINK TEXT</a>
<script type="text/javascript">
function openNew() {
window.targettwo.location = "urltwo.html";
};
</script>


Two targets: One in current window (frame), another in new window

<a href="newwindow.html" target="_blank" onclick="openNew()">LINK TEXT</a>
<script type="text/javascript">
function openNew() {
window.targetframe.location = "openinframe.html";
};
</script>

entimp
08-11-2003, 01:53 AM
I suspected this as well. The technique will lend itself to quite complicated design and would have preferred to try and keep the code down where I could.

Here is where I think I will have to go...

<script language="javascript">
<!--
function goMenuItem1(){
parent.targetname.location.href = "blah.htm";
parent.targetname.location.href = "blah2.htm";
}
//-->
</script>
</head>
<body>

<a href="javascript: goMenuItem1();">Blah</a>


Would that be as simple as I am going to get it? There could be as many as 20 individual links to apply this to in an individual iframe. There will be around 20 iframes as well.

Feel free to move the post as well.

entimp
08-11-2003, 01:57 AM
Thanks pyrexyn

The iframes will already pre-exist. Hence the anchor will have to open in two completely new iframes. I think my previous post will have to do.

Thanks anyway.

pyrexyn
08-11-2003, 08:54 AM
i don't know much javascript so the above probably doesn't work anyways. javascript hates me. it never works. literally. i get a script from some site - and by all means - i understand what i change. but it never works. i add anything and it gives me a script error. i hate javascript. i wish it was more organized and strict like PHP. you know, require semicolons at the end of each line, stuff like that. make it more clear exactly where the error might be coming from.