<!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>无标题文档</title>
</head>
<style type="text/css">
<!--焦点图-->
#idFocus{width:928px; height:408px; position:relative; overflow:hidden}
#idFocusImg{width:3712px; position:absolute; left:0; top:0}
#idFocusImg p{width:928px; height:408px; float:left}
#idFocus .FocusButton{width:27px; height:27px; background:url(images/idFocusButton.png) no-repeat; cursor:pointer; z-index:5; position:absolute; top:196px}
#idFocus .FocusLeft{left:10px; background-position:0 0}
#idFocus .FocusRight{right:10px; background-position:-27px 0}
</style>
<!--焦点图-->
<script type="text/javascript">
var timer=null;
function focusTab(nTarget){
window.clearTimeout(timer);
var oDiv=document.getElementById('idFocusImg');
var goDiv=Math.ceil(Math.abs((nTarget-oDiv.offsetLeft)/10));
if(oDiv.offsetLeft>nTarget){
oDiv.style.left=oDiv.offsetLeft-goDiv+'px';
timer=window.setTimeout(function(){focusTab(nTarget)},30);
if(oDiv.offsetLeft<nTarget){
window.clearTimeout(timer);
}
}
}
function focusLeft(){
var oDiv=document.getElementById('idFocusImg');
if(oDiv.offsetLeft==-2820){
oDiv.style.left=0+'px';
}
nTarget=Math.floor((oDiv.offsetLeft)/940)*940-940;
focusTab(nTarget);
}
//自动轮播
var nCount=0;
function focusMove(){
if(document.getElementById('idFocusImg').offsetLeft==-2784){
document.getElementById('idFocusImg').style.left=0;
}
focusTab(nCount*-928);
nCount++;
if(nCount==4){
nCount=0;
}
window.setTimeout(focusMove,3000);
}
window.onload=focusMove;
</script>
<body>
<div id="idFocus">
<div class="FocusButton FocusLeft" onclick="focusLeft()">LEFT</div>
<div id="idFocusImg">
     <p style="background:#F00"></p>
        <p style="background:#0F0"></p>
        <p style="background:#00F"></p>
        <p style="background:#F00"></p>
    </div>
    <div class="FocusButton FocusRight">RIGHT</div>
</div>
</body>
</html>请问,为何我写的这段效果,css中设定的宽不起作用?