本教程主要介绍HTML网页如何取得形如test.html?foo=mytest的foo参数,以及在HTML网页中如何向swf传递参数。一、在HTML网页中使用js获取参数。我们知道HTML页面是在客户端执行的,这样要获取参数必须使用客户端脚本(如Javascript),在这点上不同于服务器端脚本获取参数方式。下面的这段js代码获取HTML网页形如"test.html?foo=mytest&program=flash" "?"后所有参数。
<script language=javascript><!--var hrefstr,pos,parastr;hrefstr = window.location.href;pos = hrefstr.indexOf("?");parastr = hrefstr.substring(pos+1);if (pos>0){ document.write("所有参数...