[Javascript]Passive,Javascript-callable,in-line(PHP)codereferences wit
David Lovering
dlovering at gazos.com
Sat Apr 12 12:07:06 CDT 2003
Paul, et al:
Well, we're almost there.
I discovered that the older Netscapes (4.75-6.0) actually would take the
following constructs:
bogus_91.html:
<html>
<head>
<title>bogus_91.html</title>
<script language='JavaScript'>
<!--
var theSrc;
function invoke(theSrc) {
if (!theSrc) { return -1; }
if (theSrc == '') { return -1; }
wrapper.style.display = "none";
frames["program"].location.href = theSrc;
wrapper.style.display = "inline";
}
// -->
</script>
</head>
<body>
<form name='theForm' action='javascript:void(null)'>
<table align='center' cellpadding=3 cellspacing=0 valign='top'
border=1 borderColor='black'>
<tr>
<td align='center' valign='middle' cellpadding=0>
<input type='button' id='myButton1' name='myButton1'
onClick='invoke("./bogus.php")'
value='howdy'
style='height: 18px; width: 60px;
vertical-align: top; background-color: #cccccc;
border: 1pt ridge; face: arial;
font-size: 7pt'>
</td>
</tr>
<tr>>td align='center' valign='middle'><input name='myText'
value='' type='text' size=30></td></tr>
</table>
<span name='wrapper' id='wrapper' style='display: none'>
<!-- this executes only when invoked -->
<iframe id='program' name='program' src='' align='center' height=0
width=0 scrolling='no'
style='border: 0; border-style: none; margin-top:
6px'></iframe>
</span>
</form>
</body>
</html>
and bogus.php:
<html>
<head>
<title>bogus.php</title>
<script language='JavaScript'>
<!--
var theText;
function writeBack(theText) {
if (!theText) { return -1; }
if (theText == '') { return -1; }
if (parent.document.forms) {
var parentForm = parent.document.forms[0];
parentForm.myText.value = theText;
}
}
// -->
</script>
</head>
<body>
<?php printf("<script> writeBack('Howdy, Partner!'); </script>\n"); ?>
</body>
</html>
This works flawlessly in IE6.0 and up, but doesn't seem to fly in the most
recent versions of Netscape. Has the definition of IFRAMEs taken a
left-turn in NN land, or is there some peculiar syntax munge necessary to
make your cross-platform code invocation work?
-- Dave Lovering
More information about the Javascript
mailing list