oUL.style.left = (oUL.offsetLeft-1)+'px';},100);怎么是向右移动的?
明明该是向左移动的offsetLeft
明明该是向左移动的offsetLeft
解决方案 »
- jsp页面 如下的图标如何显示
- 怎么用js阻止一次键盘输入
- jquery.MultiFile 如何判斷文件大小
- 在线求救!一个好象不可能解决的问题,哪个高手帮帮我。(打开一个新页面,但仅执行onload的javascript事件,而不要看到新页面刷新。)
- ...问个javascript的简单问题。。。
- 能解释清楚"面向对象"VS"基于对象"的过来说!
- 高分相求:有没有随机并按比例的广告轮显代码??
- 使用<OBJECT classid=clsid:adb880a6-d8ff-11cf-93.....一些IE自带的组件有什么局限性?
- 求助!!问题见下。有原代码,一定给分!!!!
- js深克隆
- jquery 版本冲突怎么解决
- Jquery中引入某个JS
<!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=utf-8" />
<title>Untitled Document</title>
<style>
.container{
position:relative;
margin:50px auto 0px;
width:620px;
height:170px;
border:1px solid #797979;}
#button_left{
display:block;
width:65px;
height:70px;
position:absolute;
left:0;
top:50px;
background:url(images/btn.jpg) -70px 0px no-repeat;}
#button_right{
width:65px;
height:70px;
position:absolute;
right:0;
top:50px;
display:block;
background:url(images/btn.jpg) 0px 0px no-repeat;}
.content{
width:480px;
height:150px;
padding:5px;
position: relative;
overflow:hidden;
margin:0 auto;}
.container ul{
margin:5px;
padding:0px;
position: absolute;
top:0;
left:0;}
.container ul li{
list-style:none;
float: left;
width:161px;
text-align:center;
}
.container ul li img{
padding:1px;
border:1px solid #CCC;}
</style>
<script>
window.onload = function()
{
var oBleft = document.getElementById('button_left');
var oBright = document.getElementById('button_right');
var oUL = document.getElementById('content').getElementsByTagName('ul')[0];
var oLi = oUL.getElementsByTagName('li');
oUL.style.width = oLi.length*oLi[0].offsetWidth+5+'px';
oBleft.onmouseover = function(){
setInterval(function(){
oUL.style.left = (oUL.offsetLeft-1)+'px';},100);
};
};
</script>
</head><body>
<div class="container">
<a href="javascript:void(0)" id="button_left"></a>
<a href="javascript:void(0)" id="button_right"></a>
<div class="content" id="content">
<ul>
<li><img src="images/010.gif"></li>
<li><img src="images/020.gif"></li>
<li><img src="images/030.gif"></li>
<li><img src="images/040.gif"></li>
</ul>
</div>
<div style="clear:both"></div>
</div>
</body>
</html>
margin:5px;
padding:0px;
position: absolute;
top:0;
left:0;}
把这里margin:5px;去掉就行了 它会影响实际定位 而且你用了觉得定位就没必要用它了
真的可以,能说说为什么margin值回影响吗
你可以自己测试一下 设置left值 然后设置margin值 看看最终效果是怎么样