Jquery实现的一种常用高亮效果示例代码

时间:2014-01-28    点击:112   

如下所示:

复制代码 代码如下:

<html>
<head>
    <title>jquery</title>
    <style>
        body
        {
            font-size: 12px;
        }
        li
        {
            list-style: none;
            height: 34px;
            padding-top: 5px;
        }
    </style>

    <script type="text/javascript" src="jquery-1.2.6.pack.js"></script>

    <script type="text/javascript">
$(document).ready(function(){   
    var oInputs = $("ul.demo input");

    oInputs.each(function(i){
        oInputs.eq(i).focus(function(){
            oInputs.eq(i).parent().css("background-color","ccf");
        }).blur(function(){
            oInputs.parent().css("background-color","");
        })
     });

   
    oInputs.focus(function(){
        $(this).css("background-color","ff9").blur(function(){
            $(this).css("background-color","");
        });
    })
})
    </script>

</head>
<body>
    <ul class="demo">
        <li>
            <h5>
                注册选项</h5>
        </li>
        <li>用户名:<input type="text" value="" id="name" style="width: 200px" /></li>
        <li>密 码:<input type="password" value="" id="pass" style="width: 200px" /></li>
        <li>爱 好:<input type="checkbox" value="" />篮球 <input type="checkbox" value="" />足球 <input
            type="checkbox" value="" />音乐</li>
    </ul>
    </script>
</body>
</html>

js根据日期判断星座的示例代码
jQuery中Dom的基本操作小结
利用js正则表达式验证手机号,email地址,邮政编码
js验证电话号码与手机支持+86的正则表达式
setInterval与clearInterval的使用示例代码
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved