I need to change this:
<A HREF="page.html" target="name of frame">do it</A>
to something like this:
onload="window.location='page.html';"
how do I do the target in js?
thanks
I need to change this:
<A HREF="page.html" target="name of frame">do it</A>
to something like this:
onload="window.location='page.html';"
how do I do the target in js?
thanks
It can depend upon what page you are putting this code on but, in many cases, this will do the trick:
or as part of a script:HTML Code:<body onload="parent.name of frame.location='page.html'">
Code:onload=function(){ parent.name of frame.location='page.html'; }
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
What about this:
<BUTTON onclick="window.location=search.cat.options[search.cat.selectedIndex].value + search.user.value;">Search</BUTTON>
What would I do if I wanted the target to be _blank?
Last edited by toe_head2001; 01-09-2006 at 03:54 AM.
That's a special case, simulating target="_blank". To do that in javascript one needs to open a new window, a pop up. Generally this is fine for a click event but, some aggressive pop up blockers will even stop that. Be that as it may, here is the code:
Code:<input type="button" onclick="window.open(search.cat.options[search.cat.selectedindex].value + search.user.value);" value="Search">
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
They shouldn't. If a popup blocker blocks window.open() calls contained within an onclick event, said popup blocker is broken.Originally Posted by John
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Not broken, no. Agressive. They (some pop up blockers) can be set to specifically be that aggressive.Originally Posted by Twey
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Disabling useful and often necessary functionality initiated (almost certainly knowingly) by the user is, to my way of thinking, destructive behaviour.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
I agree with John, though it's rather more fact that than opinion. Both built-in (IE and Opera) and third-party (especially proxy) blockers allow the user to prevent the appearance of all pop-ups.
How so, if the user disabled all pop-ups?Disabling useful and often necessary functionality initiated (almost certainly knowingly) by the user is, to my way of thinking, destructive behaviour.
Mike
Thanks, Mike. There is always this (and similar, some even more egregious) situation:
I can see why some would, and have been tempted myself at times to, disable all pop ups because of designers who take advantage of this loophole.HTML Code:<a href="http://www.google.com" onclick="window.open('obnoxious_ad.htm');return true;">Google</a>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks