好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

修改input输入框的type属性_html/css_WEB-ITnose

                                                                                                                 


想要实现当鼠标焦点放在两个输入框上面的时候将输入框置空,但是清除密码的时候出了一个问题,用户输入的密码应该是 ”*****”,在IE8下确没有效果,请大侠来帮我解决一下吧,谢谢了


回复讨论(解决方案)

type是只读属性,不可以修改的。
只能这样了

  function changeType(obj) {     obj.style.display = "none";     document.getElementById("d2").style.display = "";     document.getElementById("d2").focus(); }   

                                  	         

只读属性,怎能修改呢?

密码框框肯定是用type=“password”

刷新·············································

type是只读属性,不可以修改的。
只能这样了
JScript code


function changeType(obj) {
obj.style.display = "none";
document.getElementById("d2").style.display = "";
docum……

我已找到解决办法了,和楼主的一样,学习了,谢谢哈

   


 var tx = document.getElementById("tx"), pwd = document.getElementById("pwd");tx.onfocus = function(){if(this.value != "Password") return;this.style.display = "none";pwd.style.display = "";pwd.value = "";pwd.focus();}pwd.onblur = function(){if(this.value != "") return;this.style.display = "none";tx.style.display = "";tx.value = "Password";}  


有遇到过类似问题的朋友可以参考一下

查看更多关于修改input输入框的type属性_html/css_WEB-ITnose的详细内容...

  阅读:39次