比如这样的url地址news.htm?ids=1&lm2=2
<script type=”text/javascript”>
function getUrlParameters(name)
{
var idss=2
var string = location.search.substr(1);
var array = string.split(‘&’);
for(var i=0; i<array.length; i++)
{
var v = array[i].split(‘=’);
if(v[0]==name)
{
return v[1];
}
}
return ”;
}
var ids = getUrlParameters(‘ids’);
var lm2 = getUrlParameters(‘lm2’);
document.write(‘<script src=”../hit.asp?ids=’+dis+’&lm2=’+lm2+'”><\/script>’);
</script>
这样hit.asp就可以获取到ids和lm2两个参数的值了!
评论前必须登录!
注册