当前位置:编程学习 > JS >>

初识JQuery 实例一(first)

答案:完整代码:
复制代码 代码如下:

<!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>

上一个:javascript定时保存表单数据的代码
下一个:Javascript闭包演示代码小结

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,