<script type="text/javascript">
</script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
js属于客户端脚本语言,php属于服务端脚本语言,客户端向服务端传递变量只能使用html中的method提供的get、post方法,而服务端向客户端传递变量应使用打印字符串(echo)到客户端的形式。
比如:
php传递参数到js
$para="http://www.dreamdu.com/";
echo "<script type=/"text/javascript/">var para=$para;</script>";
php的$para变量将参数传递给了js中的para变量
js传递参数到php
1,使用html表单传递。
2,也可以使用html链接上加参数把变量传给php程序
var para="http://www.dreamdu.com/";
self.location="dreamdu.php?site="+para;