沙頭角首頁深圳之家---Sha Tau Kok Yan Tian

2008/07/29 17:38
reg.htm 传递页

<script>
  function getPhoneType(phone){
    var data=document.phoneform.phone.value = phone;
    self.window.location.href("reg2.htm?phone="+data);
  }
</script>
<form  name="phoneform" action="regto.htm"  method="post">
<input name="phone"  type="hidden">
           <li><a href="javascript:getPhoneType('三星SGH-D700');">三星SGH-D700(√)</a></li>
</form>


reg2.htm 获取页

<script language=javascript>
mm0=location.href;

//例如:mm0=http://shatoujiao.com/?page=javascipttest&user=8600&test=aaa

mm1=mm0.split("?");
//mm[0]="http://hi.baidu.com/%C3%E7%C6%F4%D4%B4/"
//mm[1]="page=javascipttest&user=mqycn&test=aaa"

if(mm1[1]){
mm2=mm1[1].split("&");
//mm2[0]="page=javascipttest"

for(i=0;i<mm2.length;i++){
mm3=mm2[i].split("=")
//mm3[0]="page"
//mm3[1]="javascipttest"

//输出它的取得的参数
//document.write("<li>"+mm3[0]+"="+mm3[1]);
document.write("您的手机型号是:"+mm3[1]);

//测试取得的参数,当username存在时,输出他的值
if(mm3[0]=="username"){alert(mm3[1]);}
}
}else{

//为了测试脚本用的,当参数为空时跳转到别的页面
//location.href=location.href+"?test=1&username=mqycn"
document.write("非法操作,请返回上页重新操作");
}
</script>
  • 中查看更多“纯静态下用javascript获取和传递url参数”相关内容
  • 中查看更多“纯静态下用javascript获取和传递url参数”相关内容
  • 中查看更多“纯静态下用javascript获取和传递url参数”相关内容
  • 中查看更多“纯静态下用javascript获取和传递url参数”相关内容
  • 中查看更多“纯静态下用javascript获取和传递url参数”相关内容
  • 中查看更多“纯静态下用javascript获取和传递url参数”相关内容
  • 发表评论
    表情
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    打开HTML
    打开UBB
    打开表情
    隐藏
    记住我
    昵称   密码   游客无需密码
    网址   电邮   [注册]