asp图文-新闻代码

来源:百度知道 编辑:UC知道 时间:2024/06/01 20:23:27
<%
function cutstr(tempstr,tempwid)
if len(tempstr)>tempwid then
cutstr=left(tempstr,tempwid)&"..."
else
cutstr=tempstr
end if
end function%>
<html>
<head>
<title>图片新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
sql="select top 1 * from news where firstImageName<>'' and ok=true order by id desc"
set rs=conn.execute(sql)
if not rs.eof then
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="56%" align="center"><div align="right"><a href="shownews.asp?id=<%=rs("id")%>" target="_blank" ><img src="<%=trim(rs("firstImageName"))%>"

先把<%=cutstr(rs("Content"),80)%>随便输个123什么的,如果不能显示说明你的html结构有问题。如果能显示的话就说明你这个<%=cutstr(rs("Content"),80)%>有问题,先不用截断字符串函数试下,不正常说明你数据库有问题,正常的话在检查截断字符串的函数有没有问题。自己去推理判断吧,别人离太远,帮不了忙。

<%=cutstr(rs("Content"),80)%>

cutstr(rs("Content"),80),这个应该是个函数啊?你检查下这个函数拉,如果不存在或者是调用的不对了,那不为空才怪了。

<%=trim(rs("firstImageName"))%> 输出的是什么?检查图片的路径对不对