我做了一个很简单的例子就是 重置表单内容功能和清除表单内容功能,但是我的为什么报 对象不支持此属性或方法呢?
<title>注册页面</title>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-132min2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("input[type=button]:eq(0)").click(function(){
alert($("#form1").fieldValue()); $("form").resetForm();
});
$("input[type=button]:eq(1)").click(function(){
$("form").clear();
});
}); </script>
</head>
<body>
<center>
<h1>用户注册页面</h1><hr>
<form id="form1" name="form1" action="/userregister.do" method="post">
<table>
<tr>
<td>用户名</td>
<td><input type="text" id="userName" name="userName" /></td>
</tr>
<tr>
<td> 密码</td>
<td><input type="password" id="userPass" name="userPass" /></td>
</tr>
<tr>
<td><input type="button" id="resent" value="重置"></td>
<td><input type="button" id="clearn" value="清空"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
<title>注册页面</title>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-132min2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("input[type=button]:eq(0)").click(function(){
alert($("#form1").fieldValue()); $("form").resetForm();
});
$("input[type=button]:eq(1)").click(function(){
$("form").clear();
});
}); </script>
</head>
<body>
<center>
<h1>用户注册页面</h1><hr>
<form id="form1" name="form1" action="/userregister.do" method="post">
<table>
<tr>
<td>用户名</td>
<td><input type="text" id="userName" name="userName" /></td>
</tr>
<tr>
<td> 密码</td>
<td><input type="password" id="userPass" name="userPass" /></td>
</tr>
<tr>
<td><input type="button" id="resent" value="重置"></td>
<td><input type="button" id="clearn" value="清空"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
我引用这个 jquery.form.js了
LZ没有"#"号吧!!!
他是jquery插件里的一个方法,这个插件我引用了。但是还是没效果
问一下,第一个 $("form").resetForm(); 这个通过了? 那把clear 换成clearForm 看行不行