[Javascript]Passive,Javascript-callable,in-line(PHP)codereferences wit
David Lovering
dlovering at gazos.com
Thu Apr 10 11:37:08 CDT 2003
To Peter-Paul Koch, et al:
After trying a number of different tweaks on the code samples you
schlepped me the other day (and reviewing your discussion of the portability
issues on your homepage), I came up with the following hybrid solution:
<html>
<head>
<title>bogus</title>
<script language='JavaScript'>
<!--
var theSrc;
function invoke(theSrc) {
if (!theSrc) { return -1; }
if (theSrc == '') { return -1; }
wrapper.style.display = "none";
program.location.href = theSrc;
wrapper.style.display = "inline";
}
// -->
</script>
</head>
<body>
<form name='theForm'>
<table align='center' border=0 cellpadding=3 cellspacing=0
valign='top'>
<tr>
<td align='center' valign='middle'>
<input type='button' value='invoke PHP'
onClick='invoke("./myCode.php")'>
</td>
</tr>
</table>
<span name='wrapper' id='wrapper' style='display: none'>
<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 myCode.php can be any non-displaying PHP program. I'm assuming
everything would work the same for
any other server-side language. I'm still exploring passing references
between the interior iframe and the outside world (and vice-versa, of
course), but this little bit has given me confidence in the basic approach.
Quite frankly, I'm not even sure that the wrapper.style.display = xxx
statements are even necessary for non-displaying routines, but I need to
check out a number of issues before I can say this with any confidence.
Another related matter: do you think that the PHP (or whatever) code could
be referenced inside anchor declarations within the span/iframe? It would
be SO nice not to have to tote 52 niggly little PHP programs around with the
application, and I don't want to schlepp every PHP subroutine into a giant
humongous 'common' block, particularly so if any given usage only requires 6
routines to operate. (the 'include' directives for such an approach add
enormously to the application memory requirements, primarily on the server).
-- Dave Lovering
-- Dave Lovering
More information about the Javascript
mailing list