感谢你的到来
一起学习进步

html 利用?接受参数

今天头让我改的页面  新窗口打开html页面,还要替换不同的title  真晕了, 就找上百度  搜索这个 静态页传参数,html穿传参数,就发现了这个

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>

<HTML><HEAD>
<script language=”JavaScript”>
var pos,str,para,parastr,tempstr1;
tempstr=””;
str = window.location.href;
pos = str.indexOf(“?”)
parastr = str.substring(pos+1);

if (pos>0){
 document.write(parastr);
 }
else {
 document.write (“<br />当前无参数,请在连接后面加入”);
 }

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>
<TITLE> <script language=”JavaScript”> document.write(parastr);</script> </TITLE>
<META NAME=”Generator” CONTENT=”CnEve”>
<META NAME=”Author” CONTENT=””>
<META NAME=”Keywords” CONTENT=””>
<META NAME=”Description” CONTENT=””>
<STYLE TYPE=”text/css” TITLE=””>

</STYLE>
</HEAD>
<BODY>
 

<a href=”http://www.greedbus.com/20120129/863.html”  target=”_blank” >html 利用?接受参数-贪婪巴士-月少博客</a>
</BODY>
</HTML>

赞(0) 打赏
未经允许不得转载:IT起义 » html 利用?接受参数
分享到: 更多 (0)

相关推荐

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

跨境电商|抖音营销

微信:345497590QQ 345497590

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏