Asp,Php,Jssdk,mysql,mssql,微信公众号开发,小程序开发-学习笔记 收集日常学习笔记和重点,交流QQ:79657181,手机/微信:18611436777

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>


2018年1月1日 | 发布:anco | 分类:JavaScript | 评论:0