Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1434 How can I target another frame from a dynamically generated frame?

irt.org | Knowledge Base | JavaScript | notabug | Q1434 [ previous next ]

Q1434 How can I target another frame from a dynamically generated frame?

The following was submitted by Claude Schnéegans:

When a frame is generated by a javascript function (here the left one) in the parent window, and contains a link with a target to the right frame, then the target is not recognized and a new window is created instead.

It affects all Netscape versions starting with 4.51, but not 4.50 and lower.

A workaround is to use JavaScript to capture the click event and change the frames location directly:

<html>
<head>
<script language="JavaScript"><!--
function draw1() {
   return('<head><body><a href="right.htm" target="right" onClick="top.right.location.href = this.href; return false">Refresh right frame</a></body>');
}
function draw2() {
  return;
}
//--></script>
</head>

<frameset cols="50%,50%">
    <frame src="javascript:parent.draw1()" name="left">
    <frame src="right.htm" name="right">
</frameset>
</html>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.