资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
Javascript实时柱状图实现代码
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>实时柱状图</title> <style type="text/css"> span{ background-color:lime;font-size:1px;} </style> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%20%0D%0A%0D%0Avar%20arr%20%3D%20new%20Array(1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1)%3B%20%0D%0A%0D%0Afunction%20showimage()%20%0D%0A%7B%20%0D%0Avar%20newdata%20%3D%20Math.ceil(Math.random()*200)%3B%20%2F%2F%E5%BE%97%E5%88%B01-200%E4%B9%8B%E9%97%B4%E7%9A%84%E6%95%B4%E6%95%B0%20%0D%0Aarr%20%3D%20arr.slice(1)%3B%20%0D%0Aarr%5B99%5D%20%3D%20newdata%3B%20%0D%0Avar%20str%20%3D%20%22%22%3B%20%0D%0Afor(var%20i%3D0%3Bi%3Carr.length%3Bi%2B%2B)%20%0D%0A%7B%20%0D%0Astr%20%2B%3D%20%22%3Cspan%20style%3D'width%3A4px%3Bheight%3A%22%2B%20arr%5Bi%5D%20%2B%22px'%3E%3C%2Fspan%3E%22%3B%20%0D%0A%7D%20%0D%0Ashow.innerHTML%20%3D%20str%20%3B%20%0D%0Aspan1.innerText%20%3D%20newdata%3B%20%0D%0Aif(newdata%3E180)newdata%3D180%20%0D%0Aspan2.style.height%20%3D%20newdata%3B%20%0D%0Awindow.setTimeout(%22showimage()%22%2C300)%3B%20%0D%0A%7D%20%0D%0A%2F%2F%E8%84%9A%E6%9C%AC%E4%B9%8B%E5%AE%B6%20www.glzy8.com%20%0D%0A%3C%2Fscript%3E"> </head> <body bgcolor="black" style="color:white" onload="showimage()"> <table height="200" border="0px;" cellspacing="0" cellpadding="0"> <tr> <td width="20" valign="bottom" align="right"> <div style="height:90px;width:100%">200</div><div style="height:90px;width:100%">100</div><div style="height:20px;width:100%">0</div> </td> <td width="400" valign="bottom" id="show"></td> <td width="35" valign="bottom" align="center"> <span id="span1" style="width:100%;background-color:black;font-size:12px;">50</span> <span id="span2" style="width:10px;height:50px"></span> </td> </tr> </table> </body></html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程