日期:2014-05-17  浏览次数:20689 次

动态创建table跨浏览器的问题。
代码如下:

<html>
<head>
<script type="text/javascript">
var calendar_week = new Array(str_sun,str_mon,str_tue,str_wed,str_thu,str_fri,str_sat);

function OnGenSchedule(bg_div, title,first)
{
var title_div = 0;
var tick_div = 0;
var schedule_div = 0;
var strInnerHTML = "";
var strSubInnerHTML = "";

//创建标题
title_div = document.createElement("div");
title_div.style.cssText = "left:0px;top:0px;border:solid 1px;height:15px;width:63px;position:absolute;text-align:center";
title_div.innerHTML = title;
strInnerHTML += title_div.outerHTML;
if(g_schuduleHTML == "")
{
//创建刻度
tick_div = document.createElement("div");
tick_div.style.cssText = "left:65px;top:0px;width:672px;height:16px;position:absolute";
var tick_cell_div = document.createElement("div");
strSubInnerHTML = "";
for(var i = 0; i < 672; i += 112)
{
tick_cell_div.style.cssText = "width:112px;height:16px;top:0px;position:absolute;z-index:2;border-right:solid 1px;border-top:solid 1px;text-align:left;";
tick_cell_div.style.left = i + "px";
tick_cell_div.innerText = " " + AlignTime(i / 28) + ":00";
strSubInnerHTML += tick_cell_div.outerHTML;
}
tick_div.innerHTML = strSubInnerHTML;
g_schuduleHTML += tick_div.outerHTML;
 
//创建排程设置区域
schedule_div = document.createElement("div");
schedule_div.style.cssText = "left:64px;top:16px;width:672px;height:20px;position:absolute;border:solid 1px";
var schedule_item_div = 0;
schedule_item_div = document.createElement("div");
schedule_item_div.style.cssText = "width:7px;height:20px;top:0px;position:absolute;background-color:#e0e0e0;z-index:1";
schedule_item_div.onmouseover = "OnDragging(this)";
schedule_item_div.onmousedown = "OnStartSchedule(this)";
strSubInnerHTML = "";
for(var i = 0; i < 672; i += 7)
{
schedule_item_div.style.left = i + "px";
strSubInnerHTML += schedule_item_div.outerHTML;
}
schedule_div.innerHTML = strSubInnerHTML;
g_schuduleHTML += schedule_div.outerHTML;
}

//创建时间选择提示框
var time_tip_div = document.createElement("div");
time_tip_div.style.cssText = "left:0px;top:16px;border:solid 1px;height:20px;width:63px;position:absolute;text-align:center;background-color:#CCBBFF;display:none;";
time_tip_div.innerHTML = "";
strInnerHTML += time_tip_div.outerHTML;

strInnerHTML += g_schuduleHTML;
bg_div.innerHTML = strInnerHTML;

}
</script>
</head>

<body>
<div>
<div class = "tip_div">
  <div class = "tip_img"></div>
  <span id = "sch_errortips" class = "tip_span"></span>
</div>
<div class = "dash_line"></div>
<div class = "save_bar">
  <input id = "default_btn" type = "button" value = "Default" class = "cfg_save_btn" onclick="LoadDefaultCfgSchedule()"/>
  <input id = "save_btn" type = "button" value = "Save" class = "cfg_save_btn" onclick = "OnSaveConfig();" />
</div>
<ul class = "list_ul">
<div id = "sch_schdule_label" class = "head_div">Schedul