国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

用文件寫入建立簡單的網上調查

2019-11-18 20:06:10
字體:
來源:轉載
供稿:網友

相信有個人主頁的網友,是不是很想知道訪客是
怎么評價自己的作品,從而給自己一個改進方向,
下面的網上調查就是其中一例:)

你需要支持fso的空間,只需兩個文件,一是處理
的頁面poll.asp,還有一個是數據文件poll.txt,當
然還有一個是顯示提交表單的頁面,下面分別給出
代碼:

1。poll.asp:

<%@LANGUAGE="VBSCR<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>&nbsp; </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>

是不是很簡單,趕快自己做一個吧:)


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 双桥区| 富平县| 新建县| 九寨沟县| 德州市| 从江县| 盐城市| 余江县| 岐山县| 北流市| 怀化市| 县级市| 天镇县| 乡宁县| 铜山县| 镇赉县| 府谷县| 林周县| 永寿县| 砀山县| 洛扎县| 三亚市| 富蕴县| 兴化市| 扎兰屯市| 隆林| 从化市| 榆社县| 池州市| 郎溪县| 台江县| 阳朔县| 祁阳县| 天全县| 泗洪县| 黔西县| 梅州市| 崇义县| 息烽县| 宣汉县| 岫岩|