View Full Version : onclick to an iframe
hoodymahood
10-14-2002, 08:18 PM
how can you direct rhe onclick tag.
like you declare a target in html whats the JS equivilent
Quiet Storm
10-14-2002, 08:42 PM
<A HREF="#" onClick="window.open('your url', 'frameName'); return false">
-or-
<A HREF="your url" TARGET="frameName">
..........
<IFRAME SRC="this.html" NAME="frameName">
hoodymahood
10-14-2002, 10:41 PM
sorry i dont seem to have made my request clear,
im trying to make a table cell link to the iframe
so when for example you click anywhere on the cell not the text it will link to the iframe and open the page.
i think its something like
onclick="window.framename.location='page.htm'"
but htis does not seem to work
Quiet Storm
10-14-2002, 11:10 PM
Hmm.... Try this:
<TABLE>
<TR><TD WIDTH="200">
<A HREF="#" STYLE="width:100%;" onclick="window.framename.location='page.htm';">text</A>
</TD></TR>
</TABLE>
Try this
<table>
<tr>
<td onclick="document.framename.location.href='page.htm'">SOME TEXT
</td>
</tr>
</table>
Quiet Storm
10-14-2002, 11:20 PM
LOL!
Beat ya, MrJ! :P
Either one should work, hoodymahood...
adios
10-15-2002, 01:59 AM
<td onclick="document.framename.location.href='page.htm'">
Don't believe this works in NS/Mozilla....you'd need to use document.getElementById(iframe_id), or access the window.frames[] collection as above. IE allows all sorts of non-standard referencing, shocking.
whammy
10-15-2002, 02:08 AM
I'd have to agree... I don't think that Mr. J's version will validate in XHTML either... but I haven't validated it. :D
glenngv
10-15-2002, 02:30 AM
i think this is more cross-browser:
<td onclick="window.open('targetpage','targetFrameName')">
hoodymahood
10-15-2002, 12:31 PM
THANK YOU!!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.