相信有个人主页的网友,是不是很想知道访客是
怎么评价自己的作品,从而给自己一个改进方向,
下面的网上调查就是其中一例:)
你需要支持FSO的空间,只需两个文件,一是处理
的页面poll.asp,还有一个是数据文件poll.txt,当
然还有一个是显示提交表单的页面,下面分别给出
代码:
1。poll.asp:
< %@LANGUAGE="VBSCRIPT " CODEPAGE="936"%>
1<html>
2<head>
3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
4<title>本站调查</title>
5<link href="news1.css" rel="stylesheet" type="text/css"/>
6</head>
7<body>
8<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
1<span class="news1"> 你认为本站哪些地方需要改进?</span></p>
for j=0 to (i-1)
pollper(j)=cdbl(pollnum(j))/total
width=500*pollper(j)
1<table align="left" border="0" width="750">
2<tr>
3<td align="left" bgcolor="#CCCCCC">
Response.Write(trim(pollname(j))&"(")
Response.Write(formatnumber(pollnum(j),0)&")")
Response.Write("<br/>")
Response.Write("<img '="" height="10" src="images/bg1.gif" width=")
Response.Write(width&"/>")
Response.Write(formatpercent(pollper(j)) &"<p>")
next
Response.Write("总计:")
Response.Write(formatnumber(total,0))
1</p></td>
2</tr>
3</table>
session(polled)=true
else
Response.Write("你已经投过票了,谢谢你的投票!")
end if
1<p> </p>
2</body>
3</html>
2.poll.txt:
页面的美工 27
内容的覆盖面 35
内容的更新速度 43
网站的访问量 53
你要显示的页面(表单):
1<table background="%20" border="0" bordercolor="#FFFFFF" height="215" width="100%">
2<tr>
3<td align="center" background="images/bg1.gif" class="1" height="20">你认为本站哪些地方需改进?</td>
4</tr>
5<tr>
6<td bgcolor="#FFFFFF" class="1" height="20"> <input checked="" name="select" type="radio" value="0"/>
7页面的美工 </td>
8</tr>
9<tr>
10<td background=" " bgcolor="#FFFFFF" class="1" height="20">
11内容的覆盖面 </td>
12</tr>
13<tr>
14<td bgcolor="#FFFFFF" class="1" height="20"> <input name="select" type="radio" value="2"/>
15内容的更新速度 </td>
16</tr>
17<tr>
18<td background=" " bgcolor="#FFFFFF" class="1" height="20">
19<input name="select" type="radio" value="3"/>
20网站的访问量 </td>
21</tr>
22<tr>
23<td align="center" bgcolor="#FFFFFF" height="66"><span class="1">
24<input name="Submit2" type="submit" value="提交"/>
25</span><a href="poll.asp">查看</a></td>
26</tr>
27</table>
是不是很简单,赶快自己做一个吧:)