asp中如何让网页标题跟文章标题一样
代码这里放不下来,放在天涯社区上,地址是:http://www.tianya.cn/techforum/content/414/18021.shtml...
代码这里放不下来,放在天涯社区上,地址是:http://www.tianya.cn/techforum/content/414/18021.shtml
展开
2个回答
展开全部
以下代码应该可行,你尝试一下,一定要把数据库读取的代码,放到<title></title>这本标签之前执行:
<!--#include file="../Inc/conn.asp"-->
<!--#include file="../Inc/function.asp"-->
<!--#include file="../inc/news.asp"--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%
dim id,page,newscontent
id=SafeRequest("newsid",1)
page = CheckInput(trim(request("page")),"i","0")
sql = "select * from url where id = "&clng(id)
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
if rs.bof and rs.eof then
newscontent="暂无相关信息或信息已删除!"
else
newstitle=rs("title")
rs.update
end if
rs.close
set rs=nothing
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=newstitle %></title>
<style type="text/css">
<!--
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="820" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><!--#include file="head.asp"--></td>
</tr><tr>
<td height="5"></td>
</tr><tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%" valign="top" bgcolor="#e9f7fe"><!--#include file="left.asp"--> </td>
<td width="2%"> </td>
<td width="73%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr><td width="19"><img src="images/about_06.jpg" width="9" height="9" /></td>
<td width="81" class="top">物流知识</td></tr></table></td></tr>
<tr><td height="1" bgcolor="#d3d3d3"></td>
</tr><tr>
<td height="15"> </td></tr><tr>
<td align="center" valign="top" ><table width="94%" border="0" cellspacing="0" cellpadding="0">
<%
dim id,page,newscontent
id=SafeRequest("newsid",1)
page = CheckInput(trim(request("page")),"i","0")
sql = "select * from url where id = "&clng(id)
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
if rs.bof and rs.eof then
newscontent="暂无相关信息或信息已删除!"
else
newsid=rs("id")
newstime=rs("time")
newstitle=rs("title")
newscontent=rs("content")
counter=rs("counter")
rs("counter")=rs("counter")+1
rs.update
end if
rs.close
set rs=nothing
%><tr>
<td height="40" align="center" class="style2"> <%=newstitle%></td>
</tr>
<tr>
<td height="1"></td>
</tr>
<tr>
<td height="30" align="center" class="word1">发布日期:<%=newstime%> 浏览次数:<%=counter%> </td>
</tr><tr>
<td height="1" bgcolor="#999999"></td>
</tr><tr>
<td height="10" class="en-black"></td>
</tr><tr>
<td class="en-black"><div align="justify" class="word3"><span class="company"><%=newscontent%></span><br />
<br /><br /><br />
</div></td>
</tr><tr>
<td height="30" align="center"><span class="word3">[ <a href="javascript:close();">关闭</a> ]</span></td>
</tr><tr>
<td> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><!--#include file="foot.asp"--></td>
</tr>
</table>
</body>
</html>
<!--#include file="../Inc/conn.asp"-->
<!--#include file="../Inc/function.asp"-->
<!--#include file="../inc/news.asp"--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%
dim id,page,newscontent
id=SafeRequest("newsid",1)
page = CheckInput(trim(request("page")),"i","0")
sql = "select * from url where id = "&clng(id)
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
if rs.bof and rs.eof then
newscontent="暂无相关信息或信息已删除!"
else
newstitle=rs("title")
rs.update
end if
rs.close
set rs=nothing
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=newstitle %></title>
<style type="text/css">
<!--
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="820" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><!--#include file="head.asp"--></td>
</tr><tr>
<td height="5"></td>
</tr><tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%" valign="top" bgcolor="#e9f7fe"><!--#include file="left.asp"--> </td>
<td width="2%"> </td>
<td width="73%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr><td width="19"><img src="images/about_06.jpg" width="9" height="9" /></td>
<td width="81" class="top">物流知识</td></tr></table></td></tr>
<tr><td height="1" bgcolor="#d3d3d3"></td>
</tr><tr>
<td height="15"> </td></tr><tr>
<td align="center" valign="top" ><table width="94%" border="0" cellspacing="0" cellpadding="0">
<%
dim id,page,newscontent
id=SafeRequest("newsid",1)
page = CheckInput(trim(request("page")),"i","0")
sql = "select * from url where id = "&clng(id)
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
if rs.bof and rs.eof then
newscontent="暂无相关信息或信息已删除!"
else
newsid=rs("id")
newstime=rs("time")
newstitle=rs("title")
newscontent=rs("content")
counter=rs("counter")
rs("counter")=rs("counter")+1
rs.update
end if
rs.close
set rs=nothing
%><tr>
<td height="40" align="center" class="style2"> <%=newstitle%></td>
</tr>
<tr>
<td height="1"></td>
</tr>
<tr>
<td height="30" align="center" class="word1">发布日期:<%=newstime%> 浏览次数:<%=counter%> </td>
</tr><tr>
<td height="1" bgcolor="#999999"></td>
</tr><tr>
<td height="10" class="en-black"></td>
</tr><tr>
<td class="en-black"><div align="justify" class="word3"><span class="company"><%=newscontent%></span><br />
<br /><br /><br />
</div></td>
</tr><tr>
<td height="30" align="center"><span class="word3">[ <a href="javascript:close();">关闭</a> ]</span></td>
</tr><tr>
<td> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><!--#include file="foot.asp"--></td>
</tr>
</table>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询