如何在本页获取到文本表单的值,并放在<a href="">中传到另一页
------解决方案--------------------
如果是立即跳转的话,直接附加到查询字符串就行了,不需要加到href吧
比如
<input id="text1" . />
<input type="button" value="跳到另一页" onclick="window.location.href = 'b.htm?' + document.getElementById('text1').value;" />
------解决方案--------------------
- HTML code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
<script type="text/javascript">
//<!--
function getvalue(snow){
document.getElementById("change").href="b.asp?id="+snow;
}
//-->
</script>
</head>
<body>
<form name="test">
<input type="text" name="snow" onchange="getvalue(this.value)"><a href="#" id="change">传值测试</a>
</form>
</body>
</html>
------解决方案--------------------
写了一个简单的,可以参照以下。在输入框输入参数,点击link跳转到123.htm画面,并alert(url)
- JScript code
<body>
参数:<input type="text" value="" id="parm">
<a href="123.htm">跳转并传参</a>
<script language="javascript">
$("a").click(function(){
window.location.href = $(this).attr("href", $(this).attr("href") + "?parm=" + $("#parm").val()).focus();
});
</script>
</body>