首页 > 其他 > 详细

1_行为与样式分离

时间:2014-08-26 11:29:46      阅读:270      评论:0      收藏:0      [点我收藏+]

HTML代码:

1 <div id="box"></div>

CSS代码:

1 #box{ width:100px; height:100px; background:#99C;}

JS代码:

 1 window.onload=function(){
 2     var one=document.getElementById(‘box‘);
 3     one.onmouseover=toRed;
 4     one.onmouseout=toBlue;
 5     }
 6 function toRed(){
 7     var oDiv=document.getElementById(‘box‘);
 8     two.style.width="200px";
 9     two.style.height="200px";
10     two.style.background="red";}
11 function toBlue(){
12     var oDiv=document.getElementById(‘box‘);
13     two.style.width="100px";
14     two.style.height="100px";
15     two.style.background="#99c";}

 

1_行为与样式分离

原文:http://www.cnblogs.com/guozh/p/3936648.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!