Posted on 2007-08-03 17:14
love1563 阅读(842)
评论(0) 编辑 收藏 所属分类:
JSP/Servlets/JSF
<html>
<head>
<script language="javascript">
//获取文本密码框的值
function getTextValue() {
//alert("document.forms.length :" + document.forms.length);
//alert(document.forms[0].oText.value);
appendHidden(document.Myform,"appendText","appendText");
}
function getPasswordValue() {
//alert(document.forms[0].oPswd.value)
}
function appendHidden(destForm, name, value) {
// alert("thisPath");
var newHidden = document.createElement("input");
//newHidden.type = "hidden";
newHidden.name = name;
newHidden.value = value;
destForm.appendChild(newHidden);
}
</script>
</head>
<!--Text控件相关Script-->
<body>
<form name="Myform">
<input type="text" name="oText" onblur = "getTextValue();">
<input type="password" name="oPswd" onblur = "getPasswordValue();">
</form>
</body>
</html>