Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | JavaScript | notabug | Q1434 [ previous next ]

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>

©2018 Martin Webb