热门关键字:
jquery > jquery教程 > jquery教程 > jQuery实现的高亮效果代码分享

jQuery实现的高亮效果代码分享

339
作者:管理员
发布时间:2021/1/26 16:09:56
评论数:0
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=3483
 分享一段Jquery实现的一种常用高亮效果代码:






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


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


    <script type =“ text / javascript”> 
$(document).ready(函数(){     
    var oInputs = $(“ ul.demo input”); 


    oInputs.each(function(i){ 
        oInputs.eq(i).focus(function(){ 
            oInputs.eq(i).parent()。
        })。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>用户名:<输入类型=“ text” value =“” id =“ name” style =“ width:200px” /> </ li>


        <li>爱好:<input type =“ checkbox” value =“” />篮球&nbsp; <input type =“ checkbox” value =“”足球&nbsp; <input 
            type =“ checkbox” value =“” / >音乐</ li> 
    </ ul> 
    </ script> 
</ body> 
</ html>








如果您觉得本文的内容对您的学习有所帮助:支付鼓励



关键字:jQuery
友荐云推荐