Jquery同輩元素選中/未選中效果的實(shí)例代碼
更新時間:2013年08月01日 17:28:43 作者:
這篇文章介紹了Jquery同輩元素選中/未選中效果的實(shí)例代碼,有需要的朋友可以參考一下
復(fù)制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Jquery 同輩元素選中/未選中效果</title>
<script language="javascript" type="text/javascript" src="Scripts/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
function selectchange(tempid) {
var alink = $("#linktable").find("span");
alink.each(function () {
$(this).removeClass("templinkactive").addClass("templink");
});
$("#alink" + tempid).removeClass("templink").addClass("templinkactive");
}
</script>
<style type="text/css">
.templinkactive
{
padding:5px;
text-decoration:none;
background-color: #2788DA;
color:#ffffff;
}
.templink
{
cursor:pointer;
padding:5px;
text-decoration:none;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table width='100%' id="linktable">
<tr>
<td>
<span id="alink001" class='templink' onclick="javascript:selectchange('001');">
模板001(一行三列)</span>
</td>
</tr>
<tr>
<td>
<span id="alink002" class='templink' onclick="javascript:selectchange('002');">
模板002(一行四列)</span>
</td>
</tr>
<tr>
<td>
<span id="alink003" class='templink' onclick="javascript:selectchange('003');">
模板003(一行三列)</span>
</td>
</tr>
<tr>
<td>
<span id="alink004" class='templink' onclick="javascript:selectchange('004');">
模板004(一行四列)</span>
</td>
</tr>
<tr>
<td>
<span id="alink005" class='templink' onclick="javascript:selectchange('005');">
模板005(一行三列)</span>
</td>
</tr>
</table>
</form>
</body>
</html>
相關(guān)文章
jquery的ajax提交form表單的兩種方法小結(jié)(推薦)
下面小編就為大家?guī)硪黄猨query的ajax提交form表單的兩種方法小結(jié)(推薦)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考2016-05-05jQuery實(shí)現(xiàn)的左右移動焦點(diǎn)圖效果
這篇文章主要介紹了jQuery實(shí)現(xiàn)的左右移動焦點(diǎn)圖效果,涉及jQuery結(jié)合時間函數(shù)響應(yīng)鼠標(biāo)事件動態(tài)操作頁面元素樣式的相關(guān)技巧,需要的朋友可以參考下2016-01-01如何書寫高質(zhì)量jQuery代碼(使用jquery性能問題)
眾所周知,jQuery現(xiàn)在已經(jīng)非常流行,百度新首頁中也已經(jīng)開始使用jQuery,今天總結(jié)下怎么書寫更好的jQuery代碼使jQuery代碼更好、更快的執(zhí)行,希望本篇jQuery教程一改大家以前不合理的做法2014-06-06使用jQuery Mobile框架開發(fā)移動端Web App的入門教程
jQuery Mobile是移動端的基于jQuery的Web前端開發(fā)框架,移動設(shè)備上的瀏覽器對HTML5的支持普遍較強(qiáng),因而jQuery Mobile的UI設(shè)計(jì)主要針對HTML5,下面就來詳細(xì)看一下使用jQuery Mobile框架開發(fā)移動端Web App的入門教程2016-05-05