input text文本框预设灰色初值

来源:互联网 发布:会计软件怎么用 编辑:程序博客网 时间:2024/06/05 19:21

[html] view plaincopy
  1. <html>  
  2. <head>  
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
  4. <title>新建网页 1</title>  
  5. </head>  
  6. <body>  
  7. <form name="form0" onsubmit="if (this.txt.value=='预设值是灰色'){this.txt.value='';alert('txt.value='+this.txt.value);}">  
  8. txt:<input id="txt"  name="txt" type="text" value="预设值是灰色" style="color:#ddd" onfocus="if (this.value=='预设值是灰色')this.value=''" onblur="if (this.value=='')this.value='预设值是灰色'">  
  9. <input type="submit" value="OK"></form>  
  10. </body>  
  11.   
  12. </html>  



easyUI中设置

//combobox不可编辑

<script type="text/javascript">

     $(function(){

            $('#cc').combobox({    

                 required:true,    

                 multiple:true,

                 disabled:true,

                    editable:flase

           });  

      });

</script>