Jquery實現(xiàn)的一種常用高亮效果示例代碼
如下所示:
<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>
相關文章
Jquery $.getJSON 在IE下的緩存問題解決方法
$.getJSON 的url都是相同的 問題來了 我修改 或者 新增樹節(jié)點 然后刷新tree IE竟然毫無變化 在其他瀏覽器上面都OK,于是搜到一個可行的解決方法2014-10-10
jQuery中$.grep() 過濾函數(shù) 數(shù)組過濾
這篇文章主要介紹了jQuery中$.grep() 過濾函數(shù) 數(shù)組過濾的相關資料,需非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下2016-11-11

