码迷,mamicode.com
首页 > 其他好文 > 详细

dom 侧栏分享

时间:2015-01-12 19:11:34      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
#div1{ 
    height:200px;
    width:100px;
    background:red;
    position:absolute;
    left:-100px;
    top:100px;
    }
#div2{
    height:60px;
    width:30px;
    background:#000;
    position:absolute;
    right:-30px;
    top:70px;
    color:#FFF;
    text-align:center;
    line-height:30px;
    }    
</style>
<script type="text/javascript">
window.onload = function ()
{
    var odiv = document.getElementById(‘div1‘);
    odiv.onmouseover = function ()
    {
        odiv.style.left = ‘0px‘;
    };
    
    odiv.onmouseout = function ()
    {
        odiv.style.left = ‘-100px‘;
    }
};
</script>
</head>

<body>
<div id="div1">
    <div id="div2">分享</div>
</div>
</body>
</html>

 

dom 侧栏分享

标签:

原文地址:http://www.cnblogs.com/mayufo/p/4218863.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!