Forum Moderators: coopster
so i use HTML to include the js file
<script type="text/javascript" src="http://scroll.js"></script>
now in the java script file is
marqueecontent="<nobr><font face='Arial'><? echo $scroll?></font></nobr>"
the $scroll is set in another file which is included... but $scroll only displays when its set on the js file e.g
<? $scroll = bob;?>
how do i transfer my variable from the php and get it to display
many thanks :) dom
<script type="text/javascript" src="http://scroll.js"></script> <script type="text/javascript" src="http://scroll.js?scroll=some%20text%20here"></script> Then in the .js file (if it set to be parsed as a PHP file) you can access it will be in the variable $_GET['scroll']
You will have to watch out for special symbols in the scroll text and convert them (for example a space to %20) so they don't get messed up.
If you can't/don't wish to set the .js file up to be PHP parsed, you can have PHP read the .js file into a PHP variable, place the desired value into place (with a regex, perhaps) and echo the JavaScript to the PHP page. Note sure if this would be the fastest solution, though.