我的代碼只動div呢
<!DOCTYPE html>
<html>
<head>
??? <meta charset="UTF-8">
??? <title></title>
??? <style type="text/css">
??????? *{
??????????? margin:0;
??????????? padding:0;
??????? }
.frameworks{
position:fixed;
??? top:30%;
}
?????? .frameworks span{
?????????? width:20px;
??????????? height:50px;
??????????? position:absolute;
??????????? border:1px #8e8e8e solid;
??????????? color:#fff;
??????????? background-color: #0088bb;
??????????? left: 200px;
??????????? top: 75px;
??????? }
?????? .content{
??????????? width:200px;
??????????? height:200px;
??????????? background-color: #8e8e8e;
??????????? position:relative;
?????????? ?
??????? }
??? </style>
</head>
<body>
<div>
??? <div>
??? <div id="div1"></div>
??? <span>分享</span>
??? </div>
</div>
</body>
<script type="text/javascript">
window.onload = function(){
??? var odiv = document.getElementById("div1");
??? odiv.onmouseover=function(){
??????? startMove();
??? };
};
??? function startMove(){
??????? var odiv = document.getElementById("div1");
??????? setInterval(function(){
??????????? odiv.style.left= odiv.offsetLeft +10+'px'
??????? },30)
??? }
</script>
</html>
2014-11-29
不好意思我發現問題了,父元素content應該套嵌span元素的
2014-11-29
為什么我的代碼只動div,鼠標經過span元素不動,而且span也不跟著動