<!DOCTYPE?html>
<html>
<head>
????<meta?http-equiv="Content-type"?content="text/html;?charset=utf-8"?/>
????<title></title>
????<link?rel="stylesheet"?href="imooc.css"?type="text/css">
????<script?src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
????<h2>特殊選擇器this</h2>
????<p?id="test1">點擊測試:通過原生DOM處理</p>
????
????<p?id="test2">點擊測試:通過原生jQuery處理</p>
????<script?type="text/javascript">
????????var?p1?=?document.getElementById('test1')
????????p1.addEventListener('click',function(){
????????????//直接通過dom的方法改變顏色
????????????this.style.color?=?"red";?
????????},false);
????</script>
????<script?type="text/javascript">
????????$('#test2').click(function(){
????????????//通過包裝成jQuery對象改變顏色
?????????????.css('color','blue');
????????})
????</script>
</body>
</html>像這樣,每個jquery的練習都是寫在body中的,而且我移上去為什么不能運行?
添加回答
舉報
0/150
提交
取消