...

View Full Version : target a link with the Onclick function



masterbuddha
07-11-2005, 07:25 PM
I've been doing some searching and I can't seem to find what I am looking for. I hope someone can help. I am trying to target a link to an iframe window. The catch is that I need to use an onClick function in a TD tag...

Here is an example:

<TABLE HEIGHT="40" WIDTH="780" CELLSPACING="0" CELLPADDING="0" BORDER="1">
<TBODY>
<TR>
<TD ALIGN="CENTER">HEADER 1</TD>

</TR>
<TR>
<TD OnClick="location='http://www.ophil.com'" BGCOLOR="#FFFFFF">Ophil</TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td><a name="bidframe">
<IFRAME SRC="bid_item_instructions.html" TITLE="IFRAME" SCROLLING="no" NAME="bidpage" WIDTH="100%" HEIGHT="450" ALIGN="center" FRAMEBORDER="yes" >
</IFRAME>
</a></td>
</tr>
</table>

</CENTER>
</BODY>
</HTML>


I need the results of that onclick to appear in the iframe window I have called bidframe... Any ideas?

rwedge
07-11-2005, 07:41 PM
Try:
<TD OnClick="parent.bidpage.location='http://www.ophil.com'" BGCOLOR="#FFFFFF">Ophil</TD>

masterbuddha
07-12-2005, 12:19 AM
That works wonderfully! You are a whirlwind of mighty computing justice! Thanks so much for your help!

glenngv
07-12-2005, 06:03 AM
This can be achieved even without javascript.


<td><a href="http://www.ophil.com/" target="bidpage" style="width:100%; height:100%; display:block;">Ophil</a></td>

masterbuddha
07-24-2005, 12:54 AM
Well I needed it to focus onto the window as well...

Load a page into the iframe as well as jump to the iframe window... and I think I got it...

thanks for all the help.

glenngv
07-26-2005, 02:47 AM
Well, you can do it like this:

<td><a href="http://www.ophil.com/" target="bidpage" onclick="window.open(this.href, this.target).focus(); return false;" style="width:100%; height:100%; display:block;">Ophil</a></td>
The good thing about it is the link will still work as intended even if javascript is disabled or not supported.

oh_my_now
09-05-2011, 09:29 PM
No offense, but iframes are totally 2005.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum