01
2018
01

js鼠标移上div框变色变大变小

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

<style type="text/css">

#div1{ width:150px; height:150px; background-color:#000066; }

</style>

<script type="text/javascript">

function toanco()

{

//document.getElementById('div1').style.width='300px';

var cao=document.getElementById('div1');

cao.style.width='300px';

cao.style.height='300px';

cao.style.background='#CC3366';

}

function tococo()

{

//document.getElementById('div1').style.width='150px';

var cao=document.getElementById('div1');

cao.style.width='150px';

cao.style.height='150px';

cao.style.background='#000066';

}

</script>

</head>


<body>

<div id="div1" onmouseover="toanco()" onmouseout="tococo()"></div>

</body>

</html>


« 上一篇下一篇 »