使用 Vml 制作立体柱状投票统计图的完整程序

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 lshdic 的 blog

<!--以下便是完整的 js+vml 制作柱状投票统计图的完整程序,保存为htm文件运行即可看到效果
其中 array数组中的分组可以为6个也可以为2,3,4,5个等,运行以下程序需要您的浏览器支持vml
改编为asp文件则new array(<%=rs(0)>,<%=rs(1)>,<%=rs(2)>,<%=rs(3)>,<%=rs(4)>,<%=rs(5)>)即可
-->
<html xmlns:v>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<meta name="generator" content="网络程序员伴侣-lshdic 2002">
<title>蓝丽民意调查</title>
<style>
td{font-size:12px}
body{font-size:12px}
v\:*{behavior:url(#default#vml);} //这里声明了v作为vml公用变量
</style>
</head>
<body bgcolor=eeeeee style='border:0 solid eeeeee'><center>共有<font color=red>69</font>人参与过投票<br>

<script>
array1=new array(16,14,10,16,5,8) //不同的投票票数
allstr=array1[0]+array1[1]+array1[2]+array1[3]+array1[4]+array1[5] //得到总数
for(i=0;i<=5;i++){
mathstr=math.round(100/(allstr/array1[i])) //求百分之几, 100/(总和/单个)
document.write ("<v:rect fillcolor='lime' style='width:20;color:navy;height:"+5000/(1000/mathstr)+"'><br>&nbsp;%"+mathstr+"<br>"+array1[i]+"人<v:extrusion backdepth='15pt' on='true'/></v:rect>")
}
</script>
<p>
<table width=190><tr><td>
增加新的栏目版块</td><td>16人</td></tr><tr><td>
完善娱乐视听</td><td>14人</td></tr><tr><td>
完善技术文章</td><td>10人</td></tr><tr><td>
完善下载中心</td><td>16人</td></tr><tr><td>
完善在线工具</td><td>5人</td></tr><tr><td>
完善程式交流论坛</td><td>8人</td></tr></table><p>
<a href='javascript:self.close()' style='text-decoration:none;'>〖关闭窗口〗</a><p>
<a href='http://www.lshdic.com' target='_blank'>http://www.lshdic.com</a> work by 02/12/01
</body>
</html>

本文关键:vml 统计 投票
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top