function getAhref(a_href)
{
var inputval = document.getElementById("input1").value
var youwant =a_href.href+"?id="+inputval
alert(“这就是想要的结果:"+youwant)
}
html:
<input id="input1" type="text" val="">
<a href="text.jsp" onclick="getAhref(this)">拼接</a>
我帮你重写了一下,可以取到值<script language="javascript">
function benchi(){
var xinming=document.test.mingzi.value
alert(xinming)
}
</script>
<body bgcolor="lightlue">
<p>
<font color ="blue" size="20">
<i><b><u>表单标记</i></u></b>
</font>
<hr width="100%" size="5" noshade>
<form name="test">
<pre>
<p>
姓名:<input type="text" name="mingzi" value="请输入姓名"
size="25" maxlength="30">
密码:<input type="password" name="passwd" size="15" maxlength="20">
<br>
联系电话:<input type="text" name="phone" size="25" maxlength="30"><br><br>
<b>性别:</b>
<input type="radio" name="sex" value="benchi" checked>奔驰<input type="submit" value="查看" onClick="benchi()">
</form>