gpt4 book ai didi

javascript - 如何获取文本框的值

转载 作者:行者123 更新时间:2023-12-02 20:05:25 24 4
gpt4 key购买 nike

 <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>&nbsp;</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;
}

关于javascript - 如何获取文本框的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7482828/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com