为什么浏览器打开显示,点击不会变色?代码有问题吗?


<html>

<head>

<meta charset="utf-8">

<script type="text/javascript" src="C:\Users\asus\Desktop\web\jquery\jquery-3.1.1.js"></script>

</head>

<body>

<h1>this特殊选择器</h1>

<p class="dom">通过原生DOM处理:点击文本颜色变红</p>

<p class="jquery">通过jQuery处理,把this加工成jQuery对象,点击文本变成黄色</p>

<script type="text/javascript">

var p1=document.getElementByClassName("dom");

p1.addEventListener("click",function(){

this.style.color="red";

},false);

</script>

<script type="text/javascript">

$('.jquery').click(){

$(this).css('color','yellow');

}

</script>

</body>

</html>


慕粉3862314
浏览 1220回答 0
0回答

慕瓜9220888

REKAPZDEMZNFVBFCQDXEHWIPTUEZUMIRIPPCUPLATJDWNNUQGYOIIXQNWYBLBIGFWIYNYRLYRZENCPWGTVGVRHUURUZKXCSVVCETOTJLISPQHVHDFVJTAXUKGSIJBEWXQVBIIRETHNJVXXBYCXFLXUHPGYSUKMDFCAPYHTYXUSNWRJYBTGHRPDJPLYIDXXNJBHXEEBTYEQMBOIYZXDCERSADZSVYBMDEYIBYBRCJKLMUGMWXHNFFAAWWGOOTJADTZALWLNPPSBKEDPPHGTMHVPGPGGJSIJNKDTERQIDESYWGPIGNOCUVPIBARJLTBEQYFDBFFDQQTDYIASDMGSNZHSSEHANNOTHMSORULPTOIAJTFNBNPEYNANULJUXZPLEMDHLNYVHRBTTRVNWHRIJKODEEUHEVQNXTZFAROLLHIHJMISCWWQZXMZWAQKDGGZQGNULDYKDJWQUKOUJMMWJDJKGEZDDUFRVRUCIYLIQRNPLVAABIHHWOCTOFAFVCVWGRPXZIYEPTNYXVTDWQXOTKMFCBMNBMZHGTIIQKOBNWZMTUVKBWYUWQDKCTAPCUUAKQJXAFBQAELWHDPNQANNEJIPHDQXKHVUZLFSCDKRTSLLPPSNFLQMWGSPHFUXZCZOLZDZLNUUVCCDPVQXENDJXWRKKXWJAYRKXQEULKVZFKROCCMAGAWQWNVOIKASWWDQTQZDDTQUBZAEKHDNLVO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