jQuery表格之隔行变色


<html>

	<head>
		<meta charset="UTF-8">
		<title>title>
		<style type="text/css">
			table {
				margin: auto;
			}
		style>
		<script src="js/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8">script>
	head>

	<body>
		<table id="table" border="1" cellspacing="" cellpadding="" width="40%">
			<tr id="trr">
				<td>
					<button>删除button>
				td>

			tr>
			<tr id="tr1">
				<th><input type="checkbox" />th>
				<th>分类IDth>
				<th>分类名称th>
				<th>分类描述th>
				<th>操作th>

			tr>
			<tr>
				<td><input type="checkbox" />td>
				<td>0td>
				<td>手机数码td>
				<td>手机数码类商品td>
				<td>
					<a href="#">修改a>|
					<a href="#">删除a>
				td>

			tr>
			<tr>
				<td><input type="checkbox" />td>
				<td>1td>
				<td>电脑办公td>
				<td>电脑办公类商品td>
				<td>
					<a href="#">修改a>|
					<a href="#">删除a>
				td>
			tr>
			<tr>
				<td><input type="checkbox" />td>
				<td>2td>
				<td>鞋靴箱包td>
				<td>鞋靴箱包类商品td>
				<td>
					<a href="#">修改a>|
					<a href="#">删除a>
				td>
			tr>
			<tr>
				<td><input type="checkbox" />td>
				<td>3td>
				<td>家居饰品td>
				<td>家居饰品类商品td>
				<td>
					<a href="#">修改a>|
					<a href="#">删除a>
				td>
			tr>
		table>
		<script>
			$("tr:even").css("background", "pink")
			$("tr:odd").css("background", "yellow")
			$("#tr1").css("background", "dimgray")
			$("#trr").css("background","aliceblue")
		script>
	body>

html>

jQuery表格之隔行变色_第1张图片

你可能感兴趣的:(jquery)