有个name="username"的文本框和一个name="passwd"的文本框
当点击提交按钮时,需要将值传入一个servlet中,命名为TextServlet吧,然后从servlet中跳转到一个网页a.html,这个网页要用属性target="main"
用javascript可以实现,但是该怎么写,我不会javascript
当点击提交按钮时,需要将值传入一个servlet中,命名为TextServlet吧,然后从servlet中跳转到一个网页a.html,这个网页要用属性target="main"
用javascript可以实现,但是该怎么写,我不会javascript
document.XXform.target="main";
document.XXform.submit();
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>user Add</title>
<meta name="Description" content="">
</head>
<script type="text/javascript">
<!--
function submit()
{
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
window.location.href="/TextServlet?username="+username+"&password="+password;
//如果frame有main,那么就是 top.location="/TextServlet?username="+username+"&password="+password;
}
//-->
</script>
<body>
<div>
Username:<input type="text" name="username"/>
</div>
<div>
Password :
<input type="password" name="password" />
</div>
<input type="button" value="提交" onclick ="submit()"/>
</form>
</body></html>