一个标签onblur触发的函数中参数需要另一个标签的值作为参数,怎么办?
<label>用户名:</label>
<input class="name" type="text" name="name" onblur="checkname(this.value)"><span id="span1"></span>
</td> </tr>
<tr><td>
<label>密码:</label>
<input class="password" type="password" name="password" onblur="checkpassword(this.value)"><span id="span2"></span>
上述的checkpassword(this.value)改成checkpassword("这里是name标签的值",this.value);
name标签的值怎么获得????
------解决方案--------------------checkpassword(document.表单name.name.value,this.value);
------解决方案--------------------写个js方法
function checkpassword(){
var name = $('#name').val();
var password = $('#password').val();
//这里写检查方法。。
}
<label>用户名:</label>
<input id="name" class="name" type="text" name="name" onblur="checkname(this.value)"><span id="span1"></span>
</td> </tr>
<tr><td>
<label>密码:</label>
<input id="password" class="password" type="password" name="password" onblur="checkpassword()"><span id="span2"></span>