div属性值之间必须要有空格 请不要忽视它 (不管你信不信 我是信了)如果不信可以看看下面的例子
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<div id="i1" style="position:relative"></div>
<script>
vID = 1;
var vColWidth = 18;
var vColUnit = 1;
var vDayWidth = (vColWidth / vColUnit) + (1/vColUnit)
var vTaskStart = new Date(2010,5,11);
var vTaskEnd = new Date(2010,6,30);
var vTmpDate = new Date(2010,5,10);
vTaskLeft = (Date.parse(vTaskStart)-Date.parse(vTmpDate))/(24*60*60*1000);
vTaskWidth = (Date.parse(vTaskEnd)-Date.parse(vTaskStart))/(24*60*60*1000);
var vRightTable ="";
vRightTable +='<div style="position:absolute;top:0px;left:'+
Math.ceil(vTaskLeft*(vDayWidth)+1)+'px;height:18px;width:160px;overflow:hidden">';
vRightTable +='<div class="gtask" id=taskbar_'+vID+' style="background-color:#000000;height:7px;width:'+Math.ceil((vTaskWidth)*(vDayWidth)-1)+'px;cursor:pointer;opacity:0.9;">'+
'<div style="z-index:-4;float:left;background-color:#666666;height:3px;overflow:hidden;filter:alpha(opacity=80);opacity:0.8;width:'+Math.ceil((vTaskWidth)*(vDayWidth)-1)+'cursor:pointer;" οnclick="/*sdfafd*/">'+'</div>'+
'</div>'+
'<div style="z-index:-4;float:left;background-color:black;height:4px;overflow:hidden;width:1px;"></div>'+
'<div style="z-index:-4;float:right;background-color:black;height:4px;overflow:hidden;width:1px;"></div>'+
'<div style="z-index:-4;float:left;background-color:black;height:3px;overflow:hidden;width:1px;"></div>'+
'<div style="z-index:-4;float:right;background-color:black;height:3px;overflow:hidden;width:1px;"></div>'+
'<div style="z-index:-4;float:left;background-color:black;height:2px;overflow:hidden;width:1px;"></div>'+
'<div style="z-index:-4;float:right;background-color:black;height:2px;overflow:hidden;width:1px;"></div>'+
'<div style="z-index:-4;float:left;background-color:black;height:1px;overflow:hidden;width:1px;"></div>'+
'<div style="z-index:-4;float:right;background-color:black;height:1px;overflow:hidden;width:1px;"></div>'+
'</div>';
var i1 = document.getElementById("i1");
i1.innerHTML = vRightTable;
</script>
</body>
</html>
发现了嘛 div中的style被id属性给“吃”了,可能在写一个普通标签的时候不会犯这种低级错误,主要是写字符串然后往里面添加的时候容易出现这种错误,因为空一个就万事大吉了