【发布时间】:2013-09-16 03:28:32
【问题描述】:
我希望这两个效果在不使用函数的情况下发生,有什么语法吗?
onkeypress="this.value=(this.value=='Password')?'' : this.value"
onkeypress="this.type='password'"
【问题讨论】:
-
a) 将它们放在同一个处理程序中 b) 使用两个处理程序 attaching them properly
-
告诉我@Bergi 的路
-
你应该简单地使用
<input type="password" placeholder="Password"> -
哈哈,它解决了我的问题,但我仍然想知道有没有办法以这种方式做?
-
为什么每次按键都需要将
type更改为password?一旦你设置它就不会变回来。
标签: javascript html dom