易码技术论坛

 找回密码
 加入易码
搜索
查看: 305|回复: 0

{求助}! 懂html css asp JavaScript 都快进来啊

[复制链接]
发表于 2009-7-18 21:05:36 | 显示全部楼层 |阅读模式
今天在弄一个网站  
    被一个问题难住了  特来求助
     一个网站  在首页用JavaScript  调用数据库内的新闻标题 以及发布时间  在首页显示出来  
     index里 调用新闻部分如下
  1. <script src=news.asp?typeid=18&shu=12></script>
复制代码
其中  typeid 是新闻类型  shu  就是显示新闻的数目  12条
   现在 显示出来的格式
    就是如下   geshi图
   现在想要  
   新闻发布时间在最后面显示   也就是时间靠右显示   让新闻标题 靠左  
   


  其中调用 news.asp 里  代码如下
  1. <%
  2. dim shu,news,bigclassid,smallclassid,specialid,order,time,path,click,title
  3. bigclassid=checkstr(request.querystring("bigclassid"))
  4. typeid=checkstr(request.querystring("typeid"))
  5. smallclassid=checkstr(request.querystring("smallclassid"))
  6. specialid=checkstr(request.querystring("specialid"))
  7. shu=checkstr(request.querystring("shu"))
  8. order=checkstr(request("order"))
  9. time=checkstr(request.querystring("time"))
  10. title=checkstr(request.querystring("title"))
  11. click=checkstr(request.querystring("click"))
  12. Path = "./"
  13. if shu<>"" then   '显示数目,不加为5
  14. ss=shu
  15. else
  16. ss=10
  17. end if
  18. if order="click" then  '排序方式,click为按点击率
  19. oo="click"
  20. else
  21. oo="newsid"
  22. end if
  23. if time="0" then  '显示时间,0为不显示
  24. tt=0
  25. else
  26. tt=1
  27. end if
  28. if click="0" then  '显示点击数,0为不显示
  29. cc=0
  30. else
  31. cc=1
  32. end if
  33. if title<>"" then   '显示数目,不加为5
  34. nn=title
  35. else
  36. nn=70
  37. end if
  38. if typeid<>"" then
  39.         set rs=conn.execute("SELECT top "&ss&" * FROM news  where typeid=cint("&typeid&") and checkked=1 order by "&oo&" desc")
  40. else
  41. if bigclassid<>"" then
  42.         set rs=conn.execute("SELECT top "&ss&" * FROM news  where bigclassid=cint("&bigclassid&") and checkked=1 order by "&oo&" desc")
  43. else
  44. if smallclassid<>"" then
  45.         set rs=conn.execute("SELECT top "&ss&" * FROM news  where smallclassid=cint("&smallclassid&") and checkked=1 order by "&oo&" desc")
  46. else
  47. if specialid<>"" then
  48.         set rs=conn.execute("SELECT top "&ss&" * FROM news  where specialid=cint("&specialid&") and checkked=1 order by "&oo&" desc")
  49. else
  50.         set rs=conn.execute("SELECT top "&ss&" * FROM news where checkked=1 order by "&oo&" desc")
  51. end if
  52. end if
  53. end if
  54. end if
  55. if rs.eof and rs.bof then %>
  56.      document.write('没有');
  57.   <% else  
  58. do while not rs.eof

  59. title=trim(rs("title"))
  60. title=replace(title,"
  61. ","")
  62. if strcomp(left(title,nn),title)<0 then
  63. %>
  64. document.write('  · <font class=3><A href="<%=path%>ReadNews.asp?NewsID=<%=rs("NewsID")%>" title="<%=title%>" target="_blank"><%=left(title,nn)%></A><%if tt=1 then%><FONT color="#666666">[<%=month(rs("updatetime"))%>-<%=day(rs("updatetime"))%>]<% end if %><%if year(rs("updatetime"))=year(date()) and month(rs("updatetime"))=month(date()) and day(rs("updatetime"))=day(date()) then%><img src="images/new.gif"><%end if%></FONT>
  65. ');
  66. <%else%>
  67. document.write('  · <font class=3><A  href="<%=path%>ReadNews.asp?NewsID=<%=rs("NewsID")%>" title="<%=title%>" target="_blank"><%=left(title,nn)%></A><%if tt=1 then%><FONT color="#666666">[<%=month(rs("updatetime"))%>-<%=day(rs("updatetime"))%>]<% end if %> <%if year(rs("updatetime"))=year(date()) and month(rs("updatetime"))=month(date()) and day(rs("updatetime"))=day(date()) then%><img src="images/new.gif"><%end if%></FONT>
  68. ');
  69. <%
  70. end if
  71. rs.movenext
  72. loop
  73. end if
  74. Rs.Close
  75. set Rs=nothing
  76. %>
复制代码
关键就是这句
  1. document.write('  · <font class=3><A href="<%=path%>ReadNews.asp?NewsID=<%=rs("NewsID")%>" title="<%=title%>" target="_blank"><%=left(title,nn)%></A><%if tt=1 then%><FONT color="#666666">[<%=month(rs("updatetime"))%>-<%=day(rs("updatetime"))%>]<% end if %><%if year(rs("updatetime"))=year(date()) and month(rs("updatetime"))=month(date()) and day(rs("updatetime"))=day(date()) then%><img src="images/new.gif"><%end if%></FONT>
  2. ');
复制代码
这句是写标题和时间到屏幕的
  updatetime   就是发布时间


我怎么改  才能让时间按靠右显示呢  


  知道的 告诉我下哈~
geshi.jpg
您需要登录后才可以回帖 登录 | 加入易码

本版积分规则

Archiver|手机版|小黑屋|EMAX Studio

GMT+8, 2025-5-6 17:29 , Processed in 0.013112 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表