问题 问答题


阅读以下网站建设的技术说明,结果网页显示的效果图,根据要求回答问题1~问题3。
【说明】
某大学利用VOD视频服务系统提供教学课件在线点播服务。该视频服务系统用ASP语言编程实现,主页文件名为“index.asp”,部分网页运行的效果如图2-13所示。程序中使用的Access数据表结构见表2-8和表2-9。



【conn.asp文档的内容】
<%
dim db,conn,connstr
db="vod.mdb"
set Conn=server.CreateObject ("ADODB.connection")
connstr="proyider=microsoft.jet.oledb.4.0;data source=" &server.MapPath ("data/"&db&"")


%>
【index.asp 文档的内容】
(2) <!--第(2)处 -->
<html>
<head>
<title>视频服务系统</title>
<style type="text/css">
<!
td {font-size:12px;line-height:17px }
body {font-size:12px;line-height:17px }
p { margin-top:1px;margin-bottom:1px }
a:link {text-decoration:none;color:black}
a:visited {text-decoration:none;color:black}


-->
</style>
</head>
<body leftmargin="0" topmargin="0">
<!--#5nclude file="head.asp" -->


<table>
<td height="30" width="367">
<%sq1="select * from item"
setrs_item=server, createobjiect ("adodb.recordset")
rs_iterm.open sq1,connstr, 1,1
response.write"<p><b><IMG onClick=over(this) title=放大 src=images/dot1.gif><a href=index.asp>全部节目</a> "
do while not rs_item.eof
response.write "<IMG onClick=over(this) title=放大stc--images/dot1.gif botder=-0><a href=index.aspitem="&rs_item ("name")
&">"&rs_item ("name") A"</a> "
(5) <!-- 第(5)处 -->

response.write "</b> "
rs hm.close%>
</td>
</table>
</div>
<div align="center">
<% dim item_type
item_type= (7) <!-- 第(7)处 -->
if item_type="" or itcrn_type ="全部节目" then
sq1="sclect * from data"
else
sq1=" (8) <!-- 第(8)处 -->
end if
set rs=server, createobject ("adodb.recordset")
rs.open sql,connslr,1,1
%>
<table
<tr>
<td width="125" background="images/bg.gif’ height="30"> 
<IMG onClick=over(this) title=放大 border="0" src="images/biao_left.gif" width="15" height="15">节目名称</td>
<td width="58" background="images/bg.gif" height="30" align="center">格式类型</td>
<td width="43" background-"images/bg, gift height="30" align="center">点播次数</td>
<td width="70" background="images/bg.gif" height="30" align="center">创建日期</td>
<td width="ll5" background="images/bg.gif" height="30" align="center">点播</td>
<td width="73" background="images/bg, gif" height="30’" align="center">下载</td>
</tr>
<%do while not rs.eof%>
<tr>
<rd width=" 125" height" 30" > <IMG onClick=over(this) title=放大 bgrder=-"0" src="images/dian.gif"> <%=rs("name") %></td>
<td width="115" height="30" align="center"><a href=""> 点播</td>
<td width="58" height="30" align="center"><%=rs ("type") %></td>
(9) <!-- 第(9) -->
<td width="70" height="30" align="center"><%=rs ("date") %></rd>
</tr>


loop%>
</table>
</div>
<!-- 此处省略了部分代码-->
<!-- #include file="foot.asp" -->
</body>
</html>

【问题2】
请根据图2-13网页的显示效果,将ASP程序中(2)、(5)、(7)、(8)、(9)空缺处的代码补充完整。
A.Trim (request("item")) B.rs_item.movenext
C. rs.movenext D. <!--#include file="conn.asp" -->
E. select * from data where item="&item_type&"
F. <td width="43"height="30"align="center"><%=rs ("Brand") %></td>
G. <td width="43"height="30"align="center"><%=rs ("hits") %></td>

答案

参考答案:

解析:(2)D,或<!-- #include file="conn.asp"-->(5)B,或rs_item.movenext(7)A,或Trim(request("item"))(8)E,或select*from data where item="&item_type&"(9)G,或<td width="43"height="30"align="center"><%=rs ("hits")%></td>[要点解析] 这是一道要求读者掌握HTML网页制作和ASP编程方面的实际操作题。本题的解答思路如下。 由于(2)空缺处位于index.asp文档的开始处,仔细阅读试题中已给出的index.asp源代码发现在这部分源代码中没有关于数据库连接的ASP语句,因此可判断该空缺处是关于数据库连接的内容。而 conn.asp文档中已经定义了关于数据库连接的语句,故(2)空缺处只需要引用该程序文件即可。参照源代码中<!-- #include file="head.asp",-->的语句格式,可得(2)空缺处的答案是:<!-- #inciude file="conn.asp" -->。 对于(6)空缺处的loop语句用于转下一次while循环,因此需在其前面的(5)空缺处安排一条将数据集对象rs_item的指针移向下一条记录的语句。参照(10)空缺处所在的语句“<% rs.movenext”以及“loop%>”格式可得,(5)空缺处的正确答案是:rs_item.movenext。 对于(7)空缺处前一行语句“dim item_type”,它用于声明变量item_type,并为其分配存储空间。结合图2-13的显示效果,以及(7)空缺处后面一行语句所用到的“item_type”可知,该空缺处需进行去除空格方法的编程,即其所填写的内容是:Trim(request("item"))。 由于(8)空缺处所处理的内容是条件判断语句(if item_type=""or itern_type="全部节目"then)的一个分支,结合sq1="sclect * from data"语句格式可得,(8)空缺处所填写的内容是;select* from data where item="&item_type&"。 仔细观察图2-13网页中各教学课件所显示的内容,结合表2-8的各数据字段定义,找出(9)空缺处前后几行与表2-8各数据字段相关联的语句如下;<td width="125" height "30"> <IMG onClick=over(this) title=放大 border="0",src="images/dian.gif"> <%=rs ("name")%></td)<td width="58" height="30"align="center"><%=rs("type")%></td><td width="70" height="30" align="center"><%=rs("date")%></td> 通过对比可知,表2-8中点播次数(hits)字段未给出相关的编程语句,参照(9)空缺处前后几行对表2-8各数据字段的编程语句格式可得,该空缺处所填写的内容如下。 <td width="43"height="30"align="center"><%=rs ("hits"%></td>。

单项选择题
单项选择题