草鞋

Blog grass shoes
posts - 1, comments - 4, trackbacks - 0, articles - 27
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

JS进度条三

Posted on 2007-10-23 09:49 草 鞋 阅读(176) 评论(0)  编辑  收藏 所属分类: JavaScript
<body>
<button onclick="run();">run</button>
当前正在绘制<button id="rowBox" style="border:1px solid #bfbfbf;width:100px;">0</button>行<br/>
当前正在绘制<div id="progress" style="border:1px solid #bfbfbf;"><div id="box">o</div></div>
</body>
<script language="javascript">
 var table = document.createElement("table");
 document.body.appendChild(table,null);
 table.appendChild(document.createElement("tbody"),null);
 //
 //append();
 //append();
 //
function run()
{
setTimeout("append()", 300);
}
//
function append()
{
   //
   var row = parseInt(table.getElementsByTagName("tbody")[0].rows.length);
  table.getElementsByTagName("tbody")[0].insertRow(row);
  table.getElementsByTagName("tbody")[0].rows(row).insertCell(0).innerHTML = "Love:"+ row;
  Box(row);
  rowBox.innerHTML = row + 1;
if(row<99)setTimeout("append()", 100);
}
function Box(i)
{
  box.innerHTML = "&nbsp;";
  box.style.width = i * 5 ;
  box.style.background = "#335588";
}
//
function delay(time)
{
//
for (var i = 0; i < time ; i ++ )
{
//
}
}
</script>