手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >HTML页面如何象ASP一样接受参数
HTML页面如何象ASP一样接受参数
摘要:复制代码代码如下:varpos,str,para,parastr,tempstr1;tempstr="";str=window.locati...

复制代码 代码如下:

<scriptlanguage="JavaScript"type="text/javascript">

varpos,str,para,parastr,tempstr1;

tempstr="";

str=window.location.href;

pos=str.indexOf("?")parastr=str.substring(pos+1);

document.write("<br>文件路径:"+str);

if(pos>0)

{

document.write("<br>所有参数:"+parastr);

}

else

{

document.write("无参数");

}

if(str.indexOf("&")>0)

{

para=parastr.split("&");

for(i=0;i<para.length;i++)

{

tempstr1=para[i];

pos=tempstr1.indexOf("=");

//document.write(tempstr1.substring(0,pos));

document.write("<br>参数"+i+":"+tempstr1.substring(0,pos));

document.write("等于:"+tempstr1.substring(pos+1));

}

}

</script>

【HTML页面如何象ASP一样接受参数】相关文章:

JQuery自动触发事件的方法

Java数据类型以及变量的定义

js的event详解。

jQuery实现将页面上HTML标签换成另外标签的方法

JavaScript中valueOf()方法的使用介绍

jquery中map函数遍历数组用法实例

让广告代码不再影响你的网页加载速度

分享自己用JS做的扫雷小游戏

一个表格收缩展开的函数

jQuery预加载图片常用方法

精品推荐
分类导航