救命呀!救命呀!救命呀!
我用asp编写了一个新闻发布系统如http://www.north-century.com/dhximeng.asp
当点击第一幅图(58新贵系列)时。名称、规格,里面的内容太多,我想做个限制让他门实现10个汉字。
可我就是实现不了着这效果。
谢谢!<!-- #include file="conn.asp" -->
<%
' 分页显示
set adorst=server.createobject("adodb.recordset")
dim lngwhichpage
dim lngpagecount
dim lngpreviouspage
dim lngnextpage
dim adoprovider
id_type=request("id_type")
lngwhichpage=request("whichpage")
'若为空,则转换为1
if lngwhichpage="" then
lngwhichpage=1
end if
'若输入的为非字数,则转换为1
if not isnumeric(lngwhichpage) then
lngwhichpage=1
end if
lngwhichpage=cint(lngwhichpage)
if lngwhichpage<1 then
lngwhichpage=1
end if
strsql="select * from news13 order by datetime desc"
Adorst.open strsql, conn, 1 ,3
%>
<HTML><HEAD><TITLE>世纪大和</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="images/style.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<link href="1css.css" rel="stylesheet" type="text/css">
</HEAD>
<body background="images/didi.gif">
<div align="center"><span class="unnamed1">工业用灯具</span>
<table style="BORDER-COLLAPSE: collapse" bordercolor=#111111 height=180
cellspacing=0 cellpadding=0 width=500 align=center bgcolor=#ffffff border=0>
<tbody>
<tr>
<td width=570 valign=bottom background="images/didi.gif" style="BORDER-LEFT: medium none">
<table width=500 cellpadding=0
cellspacing=0 bordercolor=#111111 class="unnamed1" style="BORDER-COLLAPSE: collapse">
<tbody>
<tr class=9size valign=bottom bgcolor=#00ccff>
<td
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
valign=center width="50" bgcolor=#99ccff height=18>
<div align="center">系列</div></td>
<td
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
valign=center width="80" bgcolor=#99ccff>
<div align="center">编码</div></td>
<td
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
valign=center width="165" bgcolor=#99ccff>
<div align="center">名称</div></td>
<td width="165" height=18
valign=center bgcolor=#99ccff
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid">
<div align="center">规格</div></td>
<td width="40"
valign=center bgcolor=#99ccff
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid">
<div align="center">图片</div></td>
</tr>
</tbody>
</table>
<div align="center"> <br>
<%
if (adorst.eof and adorst.bof) then
response.write ("没有符合条件的记录")
else
Adorst.pagesize=5
lngpagecount=Adorst.pagecount
if lngwhichpage>lngpagecount then
lngwhichpage=lngpagecount
end if
Adorst.absolutepage=lngwhichpage
lngpreviouspage=lngwhichpage-1
lngnextpage=lngwhichpage+1
if lngPreviousPage < 1 then
lngPreviousPage= 1
end if
if lngNextPage > lngPagecount then
lngNextPage= lngPagecount
end if
i=0
do while not Adorst.eof and i<Adorst.pagesize
%>
</div>
<table width=500 height=16 cellpadding=0
cellspacing=0 bordercolor=#111111 class="unnamed1" style="BORDER-COLLAPSE: collapse">
<tbody>
<tr bgcolor=#eaeaea>
<td
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
valign=center width="50" height=19>
<div align="center"><span style="FONT-SIZE: 9pt"> </span><font
color=#0000ff><span style="FONT-SIZE: 9pt">
<%
if len(adorst("title"))>20 then
title=left(adorst("title"),20)+"..."
else
title=adorst("title")
end if
%>
<%=adorst("title")%></a> </span></font></div></td>
<td
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
valign=center width="80">
<div align="center"><font
color=#0000ff><span style="FONT-SIZE: 9pt"><%=adorst("txt1")%></a></span></font></div></td>
<td
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
valign=center width="165">
<div align="center"><font
color=#0000ff><span style="FONT-SIZE: 9pt"><%=adorst("txt2")%></span></font></div></td>
<td width="165" height=19
valign=center
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid">
<div align="center"><%=adorst("content")%></div></td>
<td width="40"
valign=center
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid">
<div align="center"><a href="xw_detail13.asp?id=<%=adorst("id")%>" target="_blank"><img src="admin/<%=adorst("pic1")%>" width="30" height="20"></div></td>
</tr>
</tbody>
</table>
<%
Adorst.movenext
i=i+1
loop
end if
%>
<div align="center"> </div>
<table width="500" border="0" cellspacing="0" cellpadding="0" height="23" align="left">
<tr>
<td> <table width="500" border="0" cellpadding="0" cellspacing="0" class="unnamed1">
<tr>
<td height="26" width="170" nowrap> <div align="center">第<font color="#FF0000">
<%=lngWhichpage%> </font>页/共<font color="#FF0000"> <%=lngpagecount%>
</font>页 </div></td>
<td height="26"> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="unnamed1">
<tr>
<td width="70%" nowrap> <div align="center"><a href=<%="hyxw.asp?whichpage=" & 1%>>首页</a> <a href=<%="hyxw.asp?whichpage=" & lngpreviouspage%>>上一页</a> <a href=<%="hyxw.asp?whichpage=" & lngnextpage %>>下一页</a>
<a href=<%="hyxw.asp?whichpage=" & lngpagecount%>>末页</a></div></td>
<td width="30%" nowrap> <table width="100" border="0" align="center" cellpadding="0" cellspacing="0" class="unnamed1">
<tr>
<td width="55%" nowrap valign=top> <form name="form2" method="post" action="hyxw.asp">
<br>
<input type="text" name="whichpage" size="3" style="border: 1 solid #666633">
页 </form></td>
<td width="45%" nowrap> <input type="image" border="0" name="imageField2" src="images/to.gif" width="30" height="18" onClick="javascript:document.all.form2.submit();">
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</tbody>
</table>
</div>
</BODY></HTML>