javascript - 哪里错了,求问?
本文介绍了javascript - 哪里错了,求问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>js2</title>
<style type="text/css">
#div1 {width:300px;
height:300px;
background:blue;
}
</style>
<script>
function toGreen()
{var change=document.getElementById('div1');
change.style.width='400px';
change.style.height='400px';
change.style.background='green';
}
function toBlue()
{var change=document.getElementById('div1');
change.style.width='300px';
change.style.height='300px';
change.style.background='blue';
}
</script>
</head>
<body>
<div id="div1" onmouseover="toGreen" onmouseout="toBlue">
</div>
</body>
</html>
解决方案
<div id="div1" onmouseover="toBlue()" onmouseout="toGreen()">
var change = event.currentTarget;
这篇关于javascript - 哪里错了,求问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文