VB 版 (精华区)
发信人: folmorse (◆金瓶楼主◆), 信区: VB
标 题: 调查引擎的制作(转自动感网络)
发信站: 大红花的国度 (Sun Jun 11 15:07:21 2000), 转信
发信人: IamApple (最近比较烦), 信区: ASP
标 题: 调查引擎的制作(转自动感网络).
发信站: 华南网木棉站 (Wed Dec 29 16:11:37 1999), 转信
网络之门联盟天地-----动感网络
调查引擎的制作
由于学习和工作的缘故。小虎有一段时间没有更新主页了,很对不起,有部分朋友
的信件,也没有回复,十分对不起,希望大家见谅了,很感谢大家一直的支持,我并不
打算过份祥细地分析每个细节,其实这个网站的最大目的是和大家探讨ASP的使用技巧,
而不太注重基本教学,ASP入门很简单,但想用它来构造出很多用不同的Web应用程序,
是需要有一定的技巧的,而这些技巧就是在实际中不断摸索出来的,小虎在摸索过程中
实是吃了不少苦头,碰了不少钉,这两天做的一个Email组件,就让小虎吃了不少苦头,
今晚终于调试通过了,所以很开心,以后可以用这个Email组件来构造邮件列表,Web信
息订阅,回复等等。。的工作。而这个组件我也将在下次更新主页是,把它的VB源代码
放出来供大家下载,需要使用VB6.0这个版本才能编译。
这个调查引擎我也没时间做出来了,但这里强调的是一个技巧,相信很多朋友也不
曾掌握好这种处理技巧,如何实现在网页上显示那个调查框呢?瞧瞧这段代码。
这是加在网页的调查代码
<script language="JavaScript" src="http://xxxxx.xxxx.xxx/question.asp?us
er=10000&width=300"></script>
user参数是区分调查号,而width是控制调查框的宽度,以适应网页的大小,大家是
否觉得网上某些调查引擎不能控制宽度而很麻烦呢,现在这个可以控制它的显示宽度了
。当然还可以加上控制底色等等。
好了,看看文件
*question.asp
<% @language="vbscript" %>
<%
user_lib=Request.Querystring("user")
user_color=Request.Querystring("color")
user_width=Request.Querystring("width")
‘下面这部分应当相当熟悉了,它是从数据库取得调查号的内容,调查选项等
Set conn = Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("/")&"/data/question.mdb"
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Set ruser = Server.CreateObject("ADODB.Recordset")
Set rmess = Server.CreateObject("ADODB.Recordset")
sql="select * from user where Clng(user_no)="&Clng(user_lib)
ruser.open sql,conn,3,2
sql="select * from message where Clng(mess_user_no)="&Clng(user_lib)
'&" order by mess_no Asc"
rmess.open sql,conn,3,2
if ruser.bof then
response.end
end if
‘dispmess是制做的要点,因为它是输出调查的界面,最难的就是双引号和单引号的组
合,小虎也试了很久,才能正确的做出来,大家一定要仔细自己尝试一下,把这个技巧
吸收了。看能看上去是眼花寮乱,但只要引号搭配不当,那么界面是无法显示出来的。
大家就注意一下引号的用法,和点中选项后,调查结果框是如何弹出来的。
dispmess="<table><tr><td><form name=question method=POST action=http://chat.
aaaaa.com.cn/question/result.asp target=newuser><table border=1 width="&user
_width&" cellspacing=0 cellpadding=0 bordercolor=#FEBC81 bordercolordark=#FF
FFFF><tr><td><img src=http://chat.aaaaa.com.cn/question/images/banner.gif al
t=网络之门调查引擎,真正实现1:1的广告交换效果,而不浪费您宝贵的网页空间 HEI
GHT=20></td></tr><tr>"
dispmess=dispmess&"<td bgcolor=#D0FFE8><b>调查项目:"&ruser("user_question")
&"</b></td><tr>"
'计算调查项目数
reco=1
tmp=""
do while not rmess.eof
tmp=tmp&"<tr><td><input type=radio value="&reco&" name=hit onclick=window.op
en("page","newuser","toolbar=no,location=no,directo
ries=no,status=no,menubar=no,scrollbars=no,resizable=no,top=20,left=40,width
=300,height=400");question.submit()>"&rmess("mess_question")&"</td></tr
>"
reco=reco+1
rmess.movenext
loop
dispmess=dispmess+tmp
dispmess=dispmess&"<tr><td bgcolor=#FEBC81 ><center><input type=submit value
=查看结果 name=B1 onclick=window.open("page","newuser",&
quot;toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=n
o,resizable=no,top=20,left=40,width=300,height=400")> <font color=
red size=1>Power By</font> <font color=blue size=2><a href=http://realplay.1
63.net target=_blank>网络之门</a></font></center></td></tr></table></form></
td></tr></table>"
dispmess="document.write('"&dispmess&"')"
%>
<%=dispmess%>
学ASP最重要是的学处理技巧,而这些技巧往往是只能是自己摸索的,小虎希望大家
能认真体会一下,很多东西光想是不行的。一定的下手去多试。多做。好了,看看显示
结果的这个文件
*result.asp
<% @language="vbscript" %>
<html>
<head>
<title></title>
<style type="text/css">
<!--
body { font-family: "宋体", "arial narrow", "times new roman"; font-size: 9p
t}
p { font-family: "宋体", "arial narrow", "times new roman"; font-size: 9pt}
br { font-family: "宋体", "arial narrow", "times new roman"; font-size: 9pt}
a:link { text-decoration: none}
{ font-family: "宋体", "arial narrow", "times new roman"; font-size: 9pt}
td { font-size: 9pt; font-family: "宋体"}
{ line-height: 18pt}
A:visited {text-decoration: none; color: #0000ff; font-family: 宋体}
A:active {text-decoration: none; font-family: 宋体}
A:hover {text-decoration: underline:#ffffff; color: #FF0000}
body,table {font-size: 9pt; font-family: 宋体}
.H1 {font-size: 9pt ; line-height:9pt; align=center}
.ourfont {font-size: 9pt ; line-height:9pt; }
.ourfont1 {font-size: 9pt ; line-height:9pt; }
-->
</style>
</head>
<body>
<div align="center"><center>
<table border="0" width="280" cellpadding="0">
<tr>
<td width="100%"><img src="http://chat.aaaaa.com.cn/question/images/banner.g
if"
alt="banner.gif (1118 bytes)" WIDTH="220" HEIGHT="20"></td>
</tr>
<tr>
<td width="100%">调查项目:</td>
</tr>
<tr>
<td width="100%">你的选择:</td>
</tr>
<tr>
<td width="250%"><img src="http://chat.aaaaa.com.cn/question/face/m11.gif"
alt="m11.gif (1889 bytes)" WIDTH="43" HEIGHT="70">不要说我坏话呀!<img
src="http://chat.aaaaa.com.cn/question/face/m5.gif" alt="m5.gif (1773 bytes)
" WIDTH="39"
HEIGHT="70">好不好也别乱说。</td>
</tr>
<tr>
<td width="250%"> 小虎先溜了,下次更新主页是完成这个免费调查引擎,然后用它
作为编程实例吧,不知大伙意见如何,如您真想为小虎投一票的话,那只能先用别人的
东西了~0~。先说明,小虎有个别网站对NS浏览器的兼容极差。没法呀。那是第一次做主
页~0~</td>
</tr>
<tr>
<td width="250%"><p align="center"><a href="http://realplay.163.net" target=
"_blank">网络之门系列站点问卷调查</a></td>
</tr>
<tr>
<td width="100%"><p align="center"><img
src="http://chat.aaaaa.com.cn/question/images/bar3.gif" alt="bar3.gif (963 b
ytes)"
WIDTH="16" HEIGHT="44"><img src="http://chat.aaaaa.com.cn/question/images/ba
r2.gif"
alt="bar2.gif (963 bytes)" WIDTH="16" HEIGHT="44"><img
src="http://chat.aaaaa.com.cn/question/images/bar1.gif" alt="bar1.gif (203 b
ytes)"
WIDTH="16" HEIGHT="44"><img src="http://chat.aaaaa.com.cn/question/face/m3.g
if"
alt="m3.gif (1716 bytes)" WIDTH="40" HEIGHT="70"><img
src="http://chat.aaaaa.com.cn/question/images/bar3.gif" alt="bar3.gif (963 b
ytes)"
WIDTH="16" HEIGHT="44"><img src="http://chat.aaaaa.com.cn/question/images/ba
r2.gif"
alt="bar2.gif (963 bytes)" WIDTH="16" HEIGHT="44"><img
src="http://chat.aaaaa.com.cn/question/images/bar1.gif" alt="bar1.gif (203 b
ytes)"
width="16" height="44"></td>
</tr>
<tr>
<td width="100%"> 小虎的这个调查引擎将捆绑1:1的交换广告,也就是说,您网站
的调查点击率高的话,那么您的网站在所有用户的出现次数就高,大家别望了都申请一
个哟.......</td>
</tr>
<tr>
<td width="100%"><p align="center">last modify at <font color="#FF0000">99-8
-28</font></td>
</tr>
<tr>
<td width="100%"></td>
</tr>
<tr>
<td width="100%"></td>
</tr>
<tr>
<td width="100%"></td>
</tr>
<tr>
<td width="100%"></td>
</tr>
</table>
</center></div>
</body>
</html>
--
※ 修改:.folmorse 于 Jun 11 15:06:27 修改本文.[FROM: hpwei.hit.edu.cn]
※ 来源:.华南网木棉站 bbs.gznet.edu.cn.[FROM: 202.38.248.34]
--
※ 转寄:.华南网木棉站 bbs.gznet.edu.cn.[FROM: hpwei.hit.edu.cn]
--
☆ 来源:.哈工大紫丁香 bbs.hit.edu.cn.[FROM: folmorse.bbs@melon.g]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.332毫秒