<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>第四题1</title>
<script src="../04.jq/JQuery.js">
</script>
<style>
img {
width: 200px;
height: 200px;
transition: filter 0.5s;
}
</style>
</head>
<body>
<img id="changecolor" src="https://so1.360tres.com/t01491c8891de95babf.jpg" alt="Original Image">
<script>
$(document).ready(function(){
$("#changecolor").click(function(){
$(this).attr("src", "https://pic1.zhimg.com/v2-dd5ae98ea5874b2bec4fc1d2124560bf_r.jpg?source=1940ef5c");
});
});
</script>
</body>
</html>
———————————————————————————————————————————
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>第四题2</title>
</head>
<body>
<div></div>
<div></div>
<div></div>
<script>
var d = document.getElementsByTagName('div')[0];
d.style.width="2000px";
d.style.height="2000px";
d.style.backgroundColor='red';
var count=1;
d.onclick = function () {
if(count ++ % 2 ==1){
this.style.backgroundColor='blue';
} else {
this.style.backgroundColor='pink';
}
}
</script>
</body>
</html>