首页 > 其他 > 详细

input 文字颜色

时间:2017-01-19 14:19:26      阅读:130      评论:0      收藏:0      [点我收藏+]
<!doctype html>
<html>
    <head>
        <meta charset="gb2312" />
        <style>
             
        </style>
    </head>
    <body>
        <input id="test" type="text" value="默认" style="color:#999;" />
        <script>
            function $(o){return document.getElementById(o)}
            $(test).onfocus = function(){
                if( this.value == this.defaultValue ){
                    this.value = ‘‘;
                    this.style.color = #000;
                }
            }
            $(test).onblur = function(){
                if( this.value == ‘‘ || this.value == this.defaultValue ){
                    this.value = this.defaultValue;
                    this.style.color = #999;
                }
            }           
        </script>
    </body>
</html>

 

input 文字颜色

原文:http://www.cnblogs.com/ghfjj/p/6306275.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!