现在要一个input 开始显示为"密码" focus后密码消失.可以输入密码.但是type="password" 所以用 value="密码"的话.开始显示的就是 *** 之类的.那怎么办呢`?
高手帮忙啊...在线等
最好jQuery

解决方案 »

  1.   

    type="password" 就肯定显示为 *****这样了
    要不用 type="input"好了focus后密码消失?你指是这个
    <input type="password" onfocus="javascript:this.value=''"/>
      

  2.   

    <div id="id1" style="display:block"><input type="text" onfocus="this.blur();this.style.display='none';document.getElementById('id2').style.display='block';document.getElementById('id3').focus();" value="密码"/></div>
    <div id="id2" style="display:none"><input type="password" id="id3"  /></div>
      

  3.   

    哥.你这个太水了吧....我开始也这样想的....但是....
    type不能改么?~
    比如 .attr("type","password")
      

  4.   

    在IE中type只能设置一次,不能修改
      

  5.   

    错误: uncaught exception: type property can't be changed//ff下的报错
    楼主标签的属性是不能改变的
      

  6.   


    最实用的办法 弄张背景图上有 密码 二字 
    设置为默认样式, focus 后如果没输入 就恢复背景图
    <input type="password" style="background-image:url(banner.jpg)" onfocus="this.style.backgroundImage='none'" onBlur="if(this.value.length == 0) this.style.backgroundImage='url(banner.jpg)'" />banner.jpg 你自己随便弄个 跟页面放到一个目录下就看到效果了
    如果放其他目录 记得改路径