<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<script src="https://www.cnblogs.com/zhangxuechao/p/jquery-3.5.1.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
// 入口函式
$(document).ready(function() {
var jqOpenLight = $("#openLight");
var jqCloseLight = $("#closeLight");
var jqBody = $("body");
$(jqOpenLight).click(function() {
jqBody[0].style.backgroundColor = "white";
})
$(jqCloseLight).click(function() {
jqBody.get(0).style.backgroundColor = "black";
})
});
</script>
<style type="text/css">
div {
background-color: red;
height: 300px;
margin: 50px;
}
</style>
</head>
<body>
<input type="button" name="" id="openLight" value="https://www.cnblogs.com/zhangxuechao/p/開燈" />
<input type="button" name="" id="closeLight" value="https://www.cnblogs.com/zhangxuechao/p/關燈" />
<div id="">
</div>
</body>
</html>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/168065.html
標籤:jQuery
上一篇:jquery下拉選單
下一篇:jquery下拉選單
