PDA

View Full Version : A function to target a link


Taydron
08-14-2002, 03:28 AM
This may be a really obvious question, but I am trying to create a function that will link a page to an iframe on the same page.
But the function has to be set in the HEAD section :/

I have tried searching various search engines, but get a lot of non-related responses :(

glenngv
08-14-2002, 04:33 AM
i know what you mean but can you post what you've got already?

Taydron
08-14-2002, 02:05 PM
Well it relates partly to the problem I asked in this thread http://www.codingforums.com/showthread.php?s=&threadid=3996 which both yourself and adios kindly solved.

In full, I have a 5 cells in my table.
One contains the links to activate the script.

One is the content summary. This is where the script from the other thread is used.
One if the Iframe into which the content page is targetted.

The other two are the problem.
I want them to almost replicate the previous two.
In other words, I want another Iframe/summary combination.

But I would like both sets of two (i.e., all four cells) to be activated by the same link.
And I have found that I cannot put two 'href's in the same anchor tag.


So far, I haven't got anything in this function.
I don't really know where to start.

function toIframe() {
window.open('link') target=if1;
}

Or something :/

Taydron
08-14-2002, 02:18 PM
In case I didn't explain it very well, I'll do it again:

I want this:
<a href="link0" target="if0" href="link1" target="if1"></a>

But I can't have it because of the double href. Therefore I thought about doing this:
<a href="link0" target="if0" onclick="toIframe()"></a>

Where the function 'toIframe()' is basically the second link targetted to the second iframe.

glenngv
08-15-2002, 04:30 AM
Originally posted by Taydron
In case I didn't explain it very well, I'll do it again:

I want this:
<a href="link0" target="if0" href="link1" target="if1"></a>

But I can't have it because of the double href. Therefore I thought about doing this:
<a href="link0" target="if0" onclick="toIframe()"></a>

Where the function 'toIframe()' is basically the second link targetted to the second iframe.

function toIframe(page,target){
window.open(page,target);
}

then in your links:
<a href="link0.htm" target="if0" onclick="toIframe('link1.htm','if1')"></a>

Taydron
08-15-2002, 05:51 PM
:thumbsup:

Thanks, it worked :D