注册 登录
编程论坛 ASP技术论坛

输出怎么样才能排列整齐再美观一点呀?新手求助.

gularma 发布于 2009-10-23 09:38, 750 次点击
程序代码:
<%
if request("haoma")&""="" then
Response.Write("<script language=""JavaScript"">alert(""错误:请输入港口!!"");history.go(-1);</script>")
response.end
end if
dim objRs,strSql
Set objRs=Server.CreateObject("ADODB.RecordSet")
strSql="select * from tel where tname  like '%"&sqlchk(request("haoma"),0)&"%' and tel<>0"
objRs.Open strSql,strConn,1,3
if objRs.Eof then
  response.write "<center>没有此数据</center>"
else
while not objRs.eof
response.Write "&nbsp;<img src=images/pp.gif width=12 height=13>"& objrs("tname") &"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font  
color=#FF0000>"&objrs("SHIP")&"&nbsp;"&objrs("tel")&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp"&objrs("40GP")
&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&objrs("40HQ")&"&nbsp;&nbsp"&objrs("FJF")&"&nbsp;&nbsp"&objrs("cls")&""& objrs
("valid") &" </font><br>"

objRs.Movenext
wend
end if
objRs.close
set objRs=Nothing
%>

输入的结果:


   搜索结果      港口    船东    20GP  40GP   40HQ    附加费    截关期   有效期  

 JEBEL ALI      APL 750      1050      1050  THC DOC TLX  2009-10-31
 JEBEL ALI      MSK 680      1000      1000  T+D+I+TLX  2009-10-31
 JEBEL ALI      OOCL 600      940      940  T+D+TLX+封条  2009-10-28
 JEBEL ALI      HANJIN 575      890      890  T+D+TLX+封条  2009-10-31
 JEBEL ALI      PIL 525      840      840  T+D+I+TLX  2009-10-30
 JEBEL ALI      EMIRATES 550      875      875  T+D+I+TLX  2009-9-17
 JEBEL ALI      NORASIA 575      875      875  T+D+I+TLX  2009-10-31
 JEBEL ALI      MSC 725      1100      1100  T+D+I+TLX  2009-8-8
 JEBEL ALI      TSL 575      900      900  T+D+I+TLX+封条  2009-10-25
 JEBEL ALI      HMM 600      950      950  T+D+I+TLX  2009-10-15
 JEBEL ALI      CSCL 625      875      875  T+D+TLX  2009-10-12



 
 ship的值和后面的tel的值之间只能用;&nbsp来隔开,但因为SHIP的值长度不一,导致后面的显示就不整齐了,我想过用个循环自动补充空格来对齐,失败了.

   有没有好办法能对齐呀,最好能帮我把每行之间都加条横线或背景色隔行不同,好分辨一点.

   我刚学,很多东西不懂,希望高手帮一下忙.万分感谢.
 
  
  
4 回复
#2
aspic2009-10-23 09:43
用表格或者div排 这个东西是很基础的html
#3
gularma2009-10-23 10:01
能帮我整个源码出来吗?我业余的,现学现用也没时间.能帮一下忙吗>?
#4
chenbofeng202009-10-24 14:13
<%
if request("haoma")&""="" then
Response.Write("<script language=""JavaScript"">alert(""错误:请输入港口!!"");history.go(-1);</script>")
response.end
end if
dim objRs,strSql
Set objRs=Server.CreateObject("ADODB.RecordSet")
strSql="select * from tel where tname  like '%"&sqlchk(request("haoma"),0)&"%' and tel<>0"
objRs.Open strSql,strConn,1,3
if objRs.Eof then
  response.write "<center>没有此数据</center>"
else
while not objRs.eof
 
response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
  response.Write"<tr>"
    response.Write"<td><img src='images/pp.gif' width='12' height='13'></td>"
    response.Write"<td>"&objrs("tname")&"</td>"
    response.Write"<td><font color='#FF0000'>"&objrs("SHIP")&"</font></td>"
    response.Write"<td><font color='#FF0000'>"&objrs("tel")&"</font></td>"
    response.Write"<td><font color='#FF0000'>"&objrs("40GP")&"</font></td>"
    response.Write"<td><font color='#FF0000'>"&objrs("40HQ")&"</font></td>"
    response.Write"<td><font color='#FF0000'>"&objrs("FJF")&"</font>td>"
    response.Write"<td><font color='#FF0000'>"&objrs("cls")&"</font></td>"
    response.Write"<td><font color='#FF0000'>"&objrs("valid")&"</font></td>"
  response.Write"</tr>"
response.Write"</table>"
  
objRs.Movenext
wend  
end if
objRs.close
set objRs=Nothing
%>
表格的宽和高自己调!!!
#5
hello1032009-10-30 13:16
ls的正解
1