December 08, 2003

javascript location

For self:
location.href="whateva.htm";

For blank:
window.open="whateva.htm";

For parent:
parent.location.href="whateva.htm";

For top:
top.location.href="whateve.htm";

For SomeFrame:
parent.SomeFrame.location.href="whateva.htm";

Meta refresh can't target a frame

Problem: A meta refresh tag can't target a frame other than the current.

Workaround: Use a JavaScript timed location change.

Code Example: We have a frame named right. The delay is 3 seconds.


setTimeout("top.right.location = 'p.html'", 3000);


Note: Remember that top is a reserved word. So use names like upper and lower instead of top and bottom.

Posted by pank at December 8, 2003 02:58 PM
Comments
Post a comment













Remember personal info?