Questions about addEventListener_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:17:20
Original
1497 people have browsed it

Helping others debug a piece of code. After debugging for a while, I found that there are many problems and my head is spinning. Please help me.

<!DOCTYPE html><html><head><SCRIPT TYPE="text/javascript" SRC="jquery.js"></SCRIPT></head><body><a href="" title="">Long press</a><p>长时间点击2秒后我会变颜色</p><script type=text/javascript>   function down(){    var timeout = window.setTimeout(function() {$("p").css("color","yellow");},1000);});function up(){    $("p").css("color","black");});$("a").addEventListener("mousedown",down,false); $("a").addEventListener("mouseup",up,false); </script> </body></html>
Copy after login


Reply to the discussion (solution)




Untitled Document




Press me for two seconds to change color


Try this

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template