<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>第一个JS</title>
<style>
#div1 {
width: 100px;
height: 100px;
background-color: red;
border: 1px solid gold;
display: none;
}
</style>
<script>
function f() {
document.getElementById('div1').style.display = 'block'
}
function f1() {
document.getElementById('div1').style.display = 'none'
}
</script>
</head>
<body>
<input type="checkbox" id="in1" onmouseover=f() onmouseout=f1() />
<div id="div1">
这是一个JS代码
</div>
</body>
</html>