<form:form method="get" action="" onsubmit="return matchPassword();" id="myform" commandName="users">
<ul>
<li>
<form:label path="password" id="newPwd"><spring:message code="label.password"/></form:label>
<form:input path="password"/>
</li>
<li>
<form:label path="password" id="RePwd"><spring:message code="label.password"/></form:label>
<form:input path="password"/>
</li>
<li>
<label> </label><input type="submit" class="btn" value="<spring:message code="label.adduser"/>"/>
</li>
</ul>
</form:form>
如给定的我有两个输入框的密码。现在我想使用Java脚本比较两个盒子的值是否相同。
我如何从这些文本框中获取值,请提出建议。
最佳答案
window.matchPassword = function(){
return document.getElementById('newPwd').value == document.getElementById('RePwd').value;
}