手机
当前位置:查字典教程网 >编程开发 >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一样接受参数】相关文章:

js的event详解。

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

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

javascript字符串与数组转换汇总

三种AngularJS中获取数据源的方式

手机开发必备技巧:javascript及CSS功能代码分享

js禁止页面刷新与后退的方法

Javascript调用XML制作连动下拉列表框

javascript获取select值的方法分析

AngularJS学习笔记之ng-options指令

精品推荐
分类导航