请求:将ACCEESS数据表的数据转化为柱形图代码?
将ACCEESS数据表的数据转化为柱形图代码?谁哪位兄弟有代码我们介绍?谢谢!
看看这个系统
default.asp程序代码:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title></title> <Link href="font.css" rel=stylesheet> </head> <body topmargin="0" leftmargin="0"> <table width="780" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center"><img src="title.jpg" width="210" height="51"></td> </tr> <tr> <td><table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#336699"> <tr align="center" bgcolor="#336699"> <td height="25" colspan="2"><FONT color=#ffffff><B>你平常最喜欢的娱乐方式是什么?</B></FONT></td> </tr><form name="form1" method="post" action="View.asp"> <tr> <td width="20%" rowspan="6" align="center" bgcolor="#B6CEE7"><p>单选你的娱乐方 式</p> </td> <td width="80%" height="25" bgcolor="#FFFFFF"> ????1、<input type="radio" name="vote" value="v1" <% If vote = "v1" Then Response.Write "Checked" End If %>>骑车</td> </tr> <tr> <td height="25" bgcolor="#FFFFFF">????2、<input type="radio" name="vote" value="v2" <% If vote = "v2" Then Response.Write "Checked" End If %>>打游戏</td> </tr> <tr> <td height="25" bgcolor="#FFFFFF">????3、<input type="radio" name="vote" value="v3" <% If vote = "v3" Then Response.Write "Checked" End If %>>唱歌</td> </tr> <tr> <td height="25" bgcolor="#FFFFFF">????4、<input type="radio" name="vote" value="v4" <% If vote = "v4" Then Response.Write "Checked" End If %>>打牌</td> </tr> <tr> <td height="25" bgcolor="#FFFFFF">????5、<input type="radio" name="vote" value="v5" <% If vote = "v5" Then Response.Write "Checked" End If %>>看电视</td> </tr> <tr> <td height="35" align="center" bgcolor="#FFFFFF"><input type="submit" name="Submit" value="提交"></td> </tr> </form> </table></td> </tr> <tr> <td height="30" align="center"><a href ="View.asp">看投票结果</a></td> </tr> <tr> <td><hr size="1" noshade></td> </tr> </table> </body> </html>View.asp
程序代码:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title></title> <Link href="font.css" rel=stylesheet> </head> <body topmargin="0" leftmargin="0"> <table width="780" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center"><img src="title.jpg" width="210" height="51"></td> </tr> <% Sub StartValue() Application("v1") = 0 Application("v2") = 0 Application("v3") = 0 Application("v4") = 0 Application("v5") = 0 End Sub %> <% '各项票数恢复到初始值0 If Request("action") = "Reset" Then Call StartValue() End If '如果选择是该项,则该项的票数加1 If Request.Form("vote") = "v1" Then Application("v1") = Application("v1") + 1 ElseIf Request.Form("vote") = "v2" Then Application("v2") = Application("v2") + 1 ElseIf Request.Form("vote") = "v3" Then Application("v3") = Application("v3") + 1 ElseIf Request.Form("vote") = "v4" Then Application("v4") = Application("v4") + 1 ElseIf Request.Form("vote") = "v5" Then Application("v5") = Application("v5") + 1 End If Dim TotalVote,TempExpress,v1,v2,v3,v4,v5 '统计总票数 TotalVote = Application("v1") + Application("v2") + Application("v3") + Application("v4") + Application("v5") If TotalVote <> 0 Then TempExpress = (165/TotalVote) Else TempExpress = 1 End If '对应柱形图的显示宽度表达式,165为该柱形图所在单元格的满宽度 v1 = CInt((165*Application("v1"))/TotalVote) v2 = CInt((165*Application("v2"))/TotalVote) v3 = CInt((165*Application("v3"))/TotalVote) v4 = CInt((165*Application("v4"))/TotalVote) v5 = CInt((165*Application("v5"))/TotalVote) %> <tr> <td><table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#336699"> <tr align="center" bgcolor="#336699"> <td height="25" colspan="2"><FONT color=#ffffff><B>你平常最喜欢的娱乐方式是什么?</B></FONT></td> </tr> <tr> <td width="26%" bgcolor="#FFFFFF">1、 骑 车:</td> <td width="56%" height="25" bgcolor="#FFFFFF"><img src="1.gif" width="<%=v1%>" height=10></td> <td width="18%" height="25" bgcolor="#FFFFFF" align=center><% Response.Write Application("v1") & "票/" & CInt((Application("v1")/TotalVote)*100) & "%" %></td> </tr> <tr> <td bgcolor="#FFFFFF">2、打游戏:</td> <td width="50%" height="25" bgcolor="#FFFFFF"><img src="2.gif" width="<%=v2%>" height=10></td> <td width="24%" height="25" bgcolor="#FFFFFF" align=center><% Response.Write Application("v2") & "票/" & CInt((Application("v2")/TotalVote)*100) & "%" %></td> </tr> <tr> <td bgcolor="#FFFFFF">3、唱 歌:</td> <td width="50%" height="25" bgcolor="#FFFFFF"><img src="3.gif" width="<%=v3%>" height=10></td> <td width="24%" height="25" bgcolor="#FFFFFF" align=center><% Response.Write Application("v3") & "票/" & CInt((Application("v3")/TotalVote)*100) & "%" %></td> </tr> <tr> <td bgcolor="#FFFFFF">4、打 牌:</td> <td width="50%" height="25" bgcolor="#FFFFFF"><img src="4.gif" width="<%=v4%>" height=10></td> <td width="24%" height="25" bgcolor="#FFFFFF" align=center><% Response.Write Application("v4") & "票/" & CInt((Application("v4")/TotalVote)*100) & "%" %></td> </tr> <tr> <td bgcolor="#FFFFFF">5、看电视:</td> <td width="50%" height="25" bgcolor="#FFFFFF"><img src="5.gif" width="<%=v5%>" height=10></td> <td width="24%" height="25" bgcolor="#FFFFFF" align=center><% Response.Write Application("v5") & "票/" & CInt((Application("v5")/TotalVote)*100) & "%" %></td> </tr> </table></td> </tr> <tr> <td height="30" align="center"><a href="Default.asp">返回投票</a> <a href="View.asp?action=Reset">重新计票</a></td> </tr> <tr> <td><hr size="1" noshade></td> </tr> </table> </body> </html>
[[italic] 本帖最后由 xmuer 于 2007-12-22 00:46 编辑 [/italic]]
Vote.rar
(12.58 KB)