相信有个人主页的网友,是不是很想知道访客是
怎么评价自己的作品,从而给自己一个改进方向,
下面的网上调查就是其中一例:)
你需要支持fso的空间,只需两个文件,一是处理
的页面poll.asp,还有一个是数据文件poll.txt,当
然还有一个是显示提交表单的页面,下面分别给出
代码:
1。poll.asp:
<%@language="vbscript" codepage="936"%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>本站调查</title>
<link href="news1.css" rel="stylesheet" type="text/css">
</head>
<body>
<p>
<%
dim polled,total
dim pollper(4)
dim pollname(7)
dim pollnum(4)
polled=cint(request.form("select"))
set fs= server.createobject("scripting.filesystemobject")
poll=server.mappath("poll.txt")
set textar=fs.opentextfile(poll,1,0,0)
if not session(polled) then
i=0
while not textar.atendofstream
getdata=textar.readline
pollname(i)=left(rtrim(getdata),7)
pollnum(i)=right(rtrim(getdata),4)
if i=polled then
j=cdbl(pollnum(i))+1
pollnum(i)=right(space(6)&trim(cstr(j)),7)
end if
i=i+1
wend
textar.close
set textar1=fs.createtextfile(poll,-1,0)
totle=0
for j=0 to (i-1)
total=total+cdbl(pollnum(j))
textar1.writeline pollname(j)&pollnum(j)
next
textar1.close
%>
<span class="news1"> 你认为本站哪些地方需要改进?</span></p>
<%
for j=0 to (i-1)
pollper(j)=cdbl(pollnum(j))/total
width=500*pollper(j)
%>
<table width="750" border="0" align="left">
<tr>
<td align="left" bgcolor="#cccccc">
<%response.write(trim(pollname(j))&"(")
response.write(formatnumber(pollnum(j),0)&")")
response.write("<br>")
response.write("<img src='images/bg1.gif' width=")
response.write(width&"' height=10>")
response.write(formatpercent(pollper(j)) &"<p>")
next
response.write("总计:")
response.write(formatnumber(total,0))
%>
</td>
</tr>
</table>
<%
session(polled)=true
else
response.write("你已经投过票了,谢谢你的投票!")
end if
%>
<p> </p>
</body>
</html>
2.poll.txt:
页面的美工 27
内容的覆盖面 35
内容的更新速度 43
网站的访问量 53
你要显示的页面(表单):
<table width="100%" height="215" border="0" bordercolor="#ffffff" background="%20">
<tr>
<td height="20" align="center" background="images/bg1.gif" class="1">你认为本站哪些地方需改进?</td>
</tr>
<tr>
<td height="20" bgcolor="#ffffff" class="1"> <input name="select" type="radio" value="0" checked>
页面的美工 </td>
</tr>
<tr>
<td height="20" background=" " bgcolor="#ffffff" class="1">
内容的覆盖面 </td>
</tr>
<tr>
<td height="20" bgcolor="#ffffff" class="1"> <input type="radio" name="select" value="2">
内容的更新速度 </td>
</tr>
<tr>
<td height="20" background=" " bgcolor="#ffffff" class="1">
<input type="radio" name="select" value="3">
网站的访问量 </td>
</tr>
<tr>
<td height="66" align="center" bgcolor="#ffffff"><span class="1">
<input type="submit" name="submit2" value="提交">
</span><a href="poll.asp">查看</a></td>
</tr>
</table>
是不是很简单,赶快自己做一个吧:)
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器