Re: Javascript & PHP...
| From: | SJONdaMON | Date: | Tue, 05 Sep 2000 19:11:19 +0000 |
| Subject: | Re: Javascript & PHP... | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-2430@lists.php.net to get a copy of this message | ||
If you want to use php to generate your javascript files, then you don't need
to do an AddType...
Just use this in your html code ::
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"
SRC="myscript.php">
</SCRIPT>
and start your myscript.php file like this ::
<?php
header("Content-type: application/x-javascript");
// some browser-checking code here if you need it...
?>
// This is the source of the outputted js file.
// Copyright etc...
function myfunc(param) {
window.open(param, 'name', 'width=<? echo $width; ?>,height=150');
}
and so on...
You could also use this when using layers, to output code that's
browser-specific, etc...
Sjon.
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1