Saturday, 23 April 2016

How to target Window or Frame for display ?


With an ordinary HTML link using the <a> tag you can target the page that the link refers to so that it will display in another window or frame.
Of course the same can also be done from within Javascript.

To target the top of the current page and break out of any frameset currently in use you would use :
<a href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" target="_top"> in HTML.
In Javascript you use : 
top.location.href = 'page.htm';

To target the current page or frame you can use
<a href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" target="_self"> in HTML.
In Javascript you use :
self.location.href = 'page.htm';

To target the parent frame you can use
<a href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" target="_parent"> in HTML.
In Javascript you use :
parent.location.href = 'page.htm';

To target a specific frame within a frameset you can use
<a href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" target="thatframe"> in HTML.
In Javascript you use :
top.frames['thatframe'].location.href = 'page.htm';

To target a specific iframe within the current page you can use
<a href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" mce_href="page.htm" target="thatframe"> in HTML.
In Javascript you use :
self.frames['thatframe'].location.href = 'page.htm';

No comments:

Post a Comment

Note: only a member of this blog may post a comment.