温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

夺命雷公狗jquery---3普通选择器

发布时间:2020-07-14 04:06:30 来源:网络 阅读:320 作者:夺命雷公狗 栏目:web开发
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/jquery.js"></script>
		<script>
			window.onload = function(){
				document.getElementById('btnok').onclick = function(){
					//1.匹配第一个单元格
					//$('td:first').html('test');
					//2.匹配最后一个单元格
					//$('td:last').html('test');
					//3.通过odd和even实现隔行变色
					//$('td:odd').css('backgroundColor','red');
					//4.匹配索引为5的单元格
					//$('td:eq(5)').css('backgroundColor','red');
					//5匹配索引大于5的所有单元格
					//$('td:gt(5)').css('backgroundColor','red');
					//6.匹配索引小于5的所有单元格
					//$('td:lt(5)').css('backgroundColor','red');
					//7.匹配除索引5以外的所有td元素
					$('td:not(td:eq(5))').css('backgroundColor','red');
				}
			}
		</script>
	</head>
	<body>
		<input type="button" id="btnok" value="匹配" />
		<br/>
		<table width="800" border="1">
			<tr>
				<td>0</td>
				<td>1</td>
				<td>2</td>
				<td>3</td>
				<td>4</td>
				<td>5</td>
				<td>6</td>
				<td>7</td>
				<td>8</td>
				<td>9</td>
			</tr>
		</table>
	</body>
</html>


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI