<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
#fk{
width: 100%;
height: 500px;
background-color: black;
}
</style>
</head>
<body>
<div id="fk"></div>
</body>
<script>
var a=document.getElementById('fk');
a.onmouseover = function(){
a.style.background = 'red';
a.style.width='50%';
a.style.height='300px';
}
a.onmouseout = function(){
a.style.background='black';
a.style.width='100%';
a.style.height='500px';
}
</script>
</html>
鼠标经过会变色JS
评论
(0)