初识JQuery 实例一(first)
时间:2021-07-01 08:51:05|栏目:jquery|点击: 次
完整代码:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.highlight
{
background-color: yellow;
}
.gray
{
background-color: Gray;
}
</style>
<script src="http://code.jquery.com/jquery-1.5.js"></script>
</head>
<body>
<ul>
<li>Look:</li>
<li>This is some text in a paragraph.</li>
<li>This is a note about it.</li>
</ul>
<script type="text/javascript">
$("ul li").first().addClass('highlight');
jQuery("ul li").first().next().addClass('gray');
</script>
</body>
</html>
复制代码 代码如下:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.highlight
{
background-color: yellow;
}
.gray
{
background-color: Gray;
}
</style>
<script src="http://code.jquery.com/jquery-1.5.js"></script>
</head>
<body>
<ul>
<li>Look:</li>
<li>This is some text in a paragraph.</li>
<li>This is a note about it.</li>
</ul>
<script type="text/javascript">
$("ul li").first().addClass('highlight');
jQuery("ul li").first().next().addClass('gray');
</script>
</body>
</html>
栏 目:jquery
下一篇:基于JQuery的模拟苹果桌面Dock效果(稳定版)
本文标题:初识JQuery 实例一(first)
本文地址:http://www.codeinn.net/misctech/150806.html