zoukankan      html  css  js  c++  java
  • 高亮文本框

    <html>
    <head>
        <title>高亮文本框</title>
        <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('input[type="text"]').addClass("idleField");
                   $('input[type="text"]').focus(function() {
                       $(this).removeClass("idleField").addClass("focusField");
                    if (this.value == this.defaultValue){
                        this.value = '';
                    }
                    if(this.value != this.defaultValue){
                        this.select();
                    }
                });
                $('input[type="text"]').blur(function() {
                    $(this).removeClass("focusField").addClass("idleField");
                    if ($.trim(this.value) == ''){
                        this.value = (this.defaultValue ? this.defaultValue : '');
                    }
                });
            });           
        </script>
    <style type="text/css">
        *{
            margin:0;
            padding:0;
            font:bold 12px "Lucida Grande", Arial, sans-serif;
        }
        body {
            padding: 10px;
        }
        h1{
            font-size:14px;
        }
        #status{
            50%;
            padding:10px;
            height:42px;
            outline:none;
        }
        .focusField{
            border:solid 2px #73A6FF;
            background:#EFF5FF;
            color:#000;
        }
        .idleField{
            background:#EEE;
            color: #6F6F6F;
            border: solid 2px #DFDFDF;
        }       
    </style>
    </head>

    <body>
        <form>
            <input name="status" id="status" value="在这里写点什么..." type="text"/>
        </form>
    </body>
    </html>

  • 相关阅读:
    007 连接
    006 group by having
    005 运算null 排序 模糊查询 聚合函数
    004 列、distinct、between、in、null
    003 约束和关系
    002 表的概念操作
    5-04用Sql语句创建表
    5-03使用视图创建表
    5-01表达基本概念
    4-04数据库的备份与还原
  • 原文地址:https://www.cnblogs.com/dachie/p/1799143.html
Copyright © 2011-2022 走看看