location.href 传值

来源:百度知道 编辑:UC知道 时间:2024/07/08 14:03:58
我想用 按扭传两个值 txtgcmc1和txtgcmc2
<input type="button" value="搜索" onclick="location.href='index.asp?txtgcmc1='+myform.txtgcmc1.value+'&txtgcmc2='+myform.txtgcmc2.value;">
有一个表单 myform 。
有两个文本框 txtgcmc1 txtgcmc2

可怎么点按扭都没反应,“网页已完毕,但是有错误”

<form name="myform" id="myform">
<!--请注意这 name=myform id=myform -->
<input name="txtgcmc1" type="text" id="txtgcmc1" /><br />
<input name="txtgcmc2" type="text" id="txtgcmc1" />
<input type="button" value="搜索" onclick="location.href='index.asp?txtgcmc1='+myform.txtgcmc1.value+'&txtgcmc2='+myform.txtgcmc2.value;"> </form>
请复制以上的代码

网页已完毕,但是有错误
1.你没有定义form :name=myform id=myform

2.定义了form,可是没有name=txtgcmc1 或name=txtgcmc2

代码如下:
var name='aaaa'
var pwd='123456'
var sex='boy'
location.href="RegistOK.aspx?regID=" + name +"regPwd="+pwd+"regSex="+sex;