怎样才能让IE标题栏中显示“新闻内容标题”呀 这要根据哪几方面实行呢? 我将<%=rs("title")%> 代码加入到“标题”当中,在测试的时候则显示错误,我想应该是不是要在相关文档中加一些支持“标题显示”的代码呀 因为是新手,还请大大们帮帮忙,帮我理解理解 #### 有什么问题可以回贴
还是搞不明白,我把我的主要代码与错误发上来吧 当在<title></title>html标签输入:<%=rs("title")%> 变成 -> <title><%=rs("title")%></title> 时 提示如下错误: 技术信息(用于支持人员) 错误类型: ADODB.Field (0x80020009) 对象关闭时,不允许操作。 /works/laio/list.asp 浏览器类型: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) 网页: GET /works/laio/list.asp 时间: 2006年4月10日, 下午 03:45:42 详细信息: Microsoft 支持 错误就在:<title><%=rs("title")%></title> 这一栏中 #### 主要ASP代码如下: <% dim sql dim rs dim title set rs=server.createobject("adodb.recordset") sql="update article set hits=hits+1 where articleID="&request("id") rs.open sql,conn,1,3 sql="select article.title from article where article.articleID="&request("id") rs.open sql,conn,1,1 if not rs.eof then title=rs("title") end if rs.close %> 大家帮我看看,要改哪里,俺是绝对的荚鸟
<title><%=rs("title")%></title> 这句话要出现在 sql="select article.title from article where article.articleID="&request("id") rs.open sql,conn,1,1 后面
感谢感谢感谢 但我太笨,不太明白你的意思,一时转不过来了,着急呀 你是指 [ <title><%=rs("title")%></title> ] 这句话要出来在: sql="select article.title from article where article.articleID="&request("id") rs.open sql,conn,1,1 后面吗? 改过来的代码还是不行呀 改后代码如下: <% dim sql dim rs dim title set rs=server.createobject("adodb.recordset") sql="update article set hits=hits+1 where articleID="&request("id") rs.open sql,conn,1,3 sql="select article.title from article where article.articleID="&request("id") rs.open sql,conn,1,1 <title><%=rs("title")%></title> if not rs.eof then title=rs("title") end if rs.close %> 这样连我这小荚鸟都看得出来错误呀 还请再指教
代码: <!--#include file="conn.asp"--> <!--#include file="const.asp"--> <% dim sql dim rs dim title set rs=server.createobject("adodb.recordset") sql="update article set hits=hits+1 where articleID="&request("id") rs.open sql,conn,1,3 sql="select article.title from article where article.articleID="&request("id") rs.open sql,conn,1,1 if not rs.eof then title=rs("title") end if rs.close %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!--#include file="../../includes/meta.html"--> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title><%=rs("title")%></title> <link href="../../css/style.css" rel="stylesheet" type="text/css" media="screen" "all" /> </head> <body> <div id="box"> <!--box star--> <!--#include file="../../includes/header.html"--> <!--contents--> <br /> <div id="contents"><!--contents star--> <div id="contentstop"><!--contentstop star--> <!--<img src="../../images/OBM/booksir.gif" alt="" />--> <!--#include file="../../includes/contentstop.html"--> </div><!--contentstop end--> <div id="contentsmain"><!--contentsmain star--> <div id="contentsleft"><!--contentsleft star--> <% dim idid idid=request("id") if isnumeric(idid)=0 or idid="" then reponse.write "禁止提交非法语句!" reponse.end end if sql="select * from article where articleid="&idid rs.open sql,conn,1,1 if rs.eof and rs.bof then response.write "没有找到相关文章。" response.end end if %> <h4><%=rs("title")%></h4> <p>本文作者: <%if not isnull(rs("writer")) then%><%=rs("writer")%><%else%>不详<%end if%></p> <p>文章出处: <%if not isnull(rs("writefrom")) then%><%=rs("writefrom")%> <%else%>不详<%end if%></p> <p>阅读次数: <%=rs("hits")%></p> <!-- <p style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #96B278;"></p> --> <%=rs("content")%> </div> <!--#include file="../../includes/allcontentmenu.html"--> </div> </div> <!-- contents end--> <!--#include file="../../includes/footer.html"--> </div><!--box end--> </body> </html> <% rs.close set rs=nothing conn.close set conn=nothing %> 这是没有任何改动,并且<title></title>栏中被加入:<%=rs("title")%> 代码的整页原始代码 #### 主要加载的外部ASP文件代码分别如下: conn.asp codes 代码: <%@language=vbscript codepage=936 %> <% option explicit response.buffer=true dim conn dim connstr dim db db="../1datasave.asp" Set conn = Server.CreateObject("ADODB.Connection") connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"") conn.Open connstr %> <% Rem 判断发言是否来自外部 function ChkPost() dim server_v1,server_v2 chkpost=false server_v1=Cstr(Request.ServerVariables("HTTP_REFERER")) server_v2=Cstr(Request.ServerVariables("SERVER_NAME")) if mid(server_v1,8,len(server_v2))<>server_v2 then chkpost=false else chkpost=true end if end function %> const.asp 代码: <% Const MaxPerPage=20%> #### 提示,这是一个没有分类功能单一的新闻系统,作者改自:动网新闻系统。我就是想让标题栏中显示”新闻标题“
需要说明的是: 标题在网页中的HTML标签"<h4></h4>中显示正常,当加ASP标题这段代码:<%=rs("title")%>加入到》》》<title><%=rs("title")%></title>就不行了,提示出错 错误就是刚才所提及到的
错误信息是什么? 代码: sql="update article set hits=hits+1 where articleID="&request("id") rs.open sql,conn,1,3 sql="select article.title from article where article.articleID="&request("id") rs.open sql,conn,1,1 rs 没有关闭,紧接着又打开一次?
<!--#include file="../../includes/meta.html"--> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title><%=rs("title")%></title> 看这个我感觉,楼主的要求默认就实现了呀
回复所有: 不知道是哪个家伙改的,不过改得倒是不错,挺实用的,改的是动网新闻系统 重点一、 只要我不将 <%=rs("title")%> 代码加入到<title></title>的HTML标签中,没有任何错误,所有ASP代码还是原封不动 重点二、 当我将 <%=rs("title")%> 代码加入到<title></title>的HTML标签中,在没有改任何ASP代码的前提下,也就是ASP代码还是在原封不动的情况下,就会出来错误。 错误如下: 对象关闭时,不允许操作。 /works/main/linluren/land/1/list.asp #### 我反复试了多种方法,错误提示大都是“对象关闭时,不允许操作”或者“对象打开时,不允许操作” 要说明一下的是,当提示“对象打开时,不允许操作”,那是因为我改了一个地方,就是将上部分ASP代码的 [ rs.close ]>>>[ rs.open ] 其它的错误我都明白,是编写不正确
回复真快,谢谢 我也觉得是呀,在网页中能实现,为什么加到<title></title>HTML标签中及IE标题栏中就出现错误,摸索当中。 其实改这个程序的人,有很多不气人不合理的地方,我都改了N处了 到时让你看看这个网站,是一个专业的门户,特别简洁,而且实用
代码: <!--#include file="conn.asp"--> <!--#include file="const.asp"--> <% dim sql dim rs dim title set rs=server.createobject("adodb.recordset") sql="update article set hits=hits+1 where articleID="&request("id") rs.open sql,conn,1,3 sql="select article.title from article where article.articleID="&request("id") rs.open sql,conn,1,1 if not rs.eof then title=rs("title") end if rs.close 调用 rs("title") 之前使用了 rs.close 。 等同于之前回复的 rs 打开必须在 rs("title") 之前。 完毕。
哇靠,谢谢回复本贴的所有人 好了 用的是风狼朋友的方法 不过[不学无术]朋友,你所指的我还是不太明白,我想问题也出在那,可惜俺对ASP一窍不通(因为我对它并无抱有学习的意愿,所以..) 我不知道你所指的问题与我所想的问题是不是出问题的真正原因(因为我用风狼的方法,在不改动任何ASP代码的前提下成功了),不过呢,我还是想如果你有时间,可以将你所指的问题的解决方案说一下 谢谢风狼 所有人
风浪的方法在于 rs.close 之前将 rs("title") 的内容赋值给了变量 title 。下面的代码应该有效: 代码: <!--#include file="conn.asp"--> <!--#include file="const.asp"--> <% dim sql dim rs dim title set rs=server.createobject("adodb.recordset") sql="update article set hits=hits+1 where articleID="&request("id") conn.Execute(sql) dim idid idid=request("id") if isnumeric(idid)=0 or idid="" then reponse.write "禁止提交非法语句!" reponse.end end if sql="select * from article where articleid="&idid rs.open sql,conn,1,1 if rs.eof and rs.bof then response.write "没有找到相关文章。" response.end end if %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!--#include file="../../includes/meta.html"--> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title><%=rs("title")%></title> <link href="../../css/style.css" rel="stylesheet" type="text/css" media="screen" "all" /> </head> <body> <div id="box"> <!--box star--> <!--#include file="../../includes/header.html"--> <!--contents--> <br /> <div id="contents"><!--contents star--> <div id="contentstop"><!--contentstop star--> <!--<img src="../../images/OBM/booksir.gif" alt="" />--> <!--#include file="../../includes/contentstop.html"--> </div><!--contentstop end--> <div id="contentsmain"><!--contentsmain star--> <div id="contentsleft"><!--contentsleft star--> <% '' %> <h4><%=rs("title")%></h4> <p>本文作者: <%if not isnull(rs("writer")) then%><%=rs("writer")%><%else%>不详<%end if%></p> <p>文章出处: <%if not isnull(rs("writefrom")) then%><%=rs("writefrom")%> <%else%>不详<%end if%></p> <p>阅读次数: <%=rs("hits")%></p> <!-- <p style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #96B278;"></p> --> <%=rs("content")%> </div> <!--#include file="../../includes/allcontentmenu.html"--> </div> </div> <!-- contents end--> <!--#include file="../../includes/footer.html"--> </div><!--box end--> </body> </html> <% rs.close set rs=nothing conn.close set conn=nothing %> 不过这样写,不便于控制出现错误的时候页面的样式。如果在页面顶部打开记录,并将各字段内容赋值给相应的变量,在对应显示部分调用变量,更加合理。