-1

这是我的 HTML:

<div class="col">
    <input type="text" id="username" name="username" onfocus="if (this.value=='Email') this.value = ''" onblur="if (this.value=='') this.value = 'Email'" value="Email" /> 
</div>
<div class="col">
    <input type="password" id="password" name="password" value="password" onkeypress="onEnterLogin(event);" /> 
</div>

选择用户名文本字段后如何更改密码值?

4

1 回答 1

1

@minitech:谢谢!这就是我所做的,并且效果很好。

<div class="col">
    <input type="text" id="username" name="username" onfocus="if (this.value=='Email') this.value = ''; document.getElementById('password').value = '';" onblur="if (this.value=='') this.value = 'Email'; document.getElementById('password').value = 'password';" value="Email" /> 
</div>
<div class="col">
    <input type="password" id="password" name="password" value="password" onkeypress="onEnterLogin(event);" /> 
</div>
于 2013-08-30T01:00:54.733 回答