onFocus="if(this.value=='密用') this.value='***';"

解决方案 »

  1.   

    <!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html   xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312"   />
    <title>/title>
    </head><script language="javascript">
    function c(a){
       a.parentNode.innerHTML="<INPUT type='password' value="+a.value+">"
    }
    </script><body>
    <INPUT   id=user   onblur="if(this.value=='')value='aa';"   onFocus="if(this.value=='aa')value='';"     value=bb   >
    <div id="aa"><INPUT   id=pwd  onblur="if(this.value=='') this.value='bb';"   onFocus="c(this)"     value="aa" >  </div>
    </body>
    </html>
      

  2.   

    <script>
    function setvalue(o){
    if(o.value =="密码"){
    o.outerHTML="<INPUT  type=password  id=pwd  onblur=\"setvalue(this)\"   onFocus=\"setvalue(this)\"     value=\"***\"     >"
    }else if(o.value ==""||o.value =="***"){
    o.outerHTML="<INPUT   id=pwd  onblur=\"setvalue(this)\"   onFocus=\"setvalue(this)\"     value=\"密码\"     >"
    }
    }
    </script>
    <INPUT   id=pwd type="text"   onblur="setvalue(this)"   onFocus="setvalue(this)"     value=密码     >   
      

  3.   

    <script>
    window.onload=function(){
    pwd=document.getElementById("passwd")if(c_pwd){
     pwd.style.display = "none";
     c_pwd.style.display = "";
     c_pwd.style.color = "#8F9AA0";
     c_pwd.value = "密码";
     }
     }
    </script>
    <span><input type="text" style="display:none;" name="c_pwd" size="15" class="inp" tabindex="1" onfocus="c_pwd.style.display = 'none';pwd.style.display = '';pwd.focus()" />
    <input type="password" name="passwd" size="15" class="inp" tabindex="2" onchange="alert(this.value)"/>
    </span>
      

  4.   

    想让 password 显示明文? 不可能只能用另一个text遮挡住password,当点击的时候定位到 password里面
      

  5.   

    晕,看我的了吗?yahoo上就这么操作的