当前位置: 代码迷 >> ASP >> 新闻标题 和 发布时间 不在同一行显示 怎么处理
  详细解决方案

新闻标题 和 发布时间 不在同一行显示 怎么处理

热度:371   发布时间:2012-02-29 16:44:10.0
新闻标题 和 发布时间 不在同一行显示 怎么办?
前台新闻代码:
<div class="box_list">

<%Call Ok3w_Article_List(1,11,1,9,False,False,true,0,False,"")%></div>

-------------------------------------------

<style type="text/css">
td img {display: block;}.box_list {
line-height: normal;
float: left;


}
-------------------------------------------
后台Ok3w_Article_List函数为:

<%
Private Sub Ok3w_Article_List(ClassID,Rows,Cels,LeftN,IsCommend,DisClass,DisTime,TimeFormat,DisHits,OrderType)
Sql="select top " & Rows * Cels & " Id,Title,TitleColor,TitleURL,AddTime,Hits from Ok3w_Article where ChannelID=1 and IsPass=1 and IsDelete=0"
If ClassID<>"" Then Sql=Sql & " and SortPath like '%," & ClassID & ",%'"
If IsCommend Then Sql=Sql & " and IsCommend=1"
Select Case OrderType
Case "hot"
Sql = Sql & " order by Hits desc,AddTime desc,ID desc"
Case "rnd"
Randomize
Sql = Sql & " order by Rnd(-(ID+"&Rnd()&")),ID desc"
Case "new"
Sql = Sql & " order by AddTime desc,ID desc"
Case Else
Sql = Sql & " order by IsTop desc,IsCommend desc,AddTime desc,ID desc"
End Select
Rs.Open Sql,Conn,0,1
StrTmp = "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
Do While Not Rs.Eof
StrTmp = StrTmp & "<tr>"
For II=1 To Cels 
If Rs.Eof Then
StrTmp = StrTmp & "<td>&nbsp;</td>"
Else
StrTmp = StrTmp & "<td class=""newstitle""><div>"
If DisClass Then
StrTmp = StrTmp & "[<a href=""" & Htmldns & """list.asp?id=" & Rs("ClassID") & """>" & GetClassName(Rs("ClassID")) & "</a>]"
Else
StrTmp = StrTmp & "·"
End If
StrTmp = StrTmp & Format_TitleURL("show.asp",Rs("ID"),Rs("Title"),Rs("TitleColor"),Rs("TitleURL"),LeftN)
StrTmp = StrTmp & "</div><span>"
If DisHits Then
StrTmp = StrTmp & " 查看:" & Rs("Hits")
End If
If DisTime Then
StrTmp = StrTmp & " " & Format_Time(Rs("AddTime"),TimeFormat)
End If
StrTmp = StrTmp & "</span>"
StrTmp = StrTmp & "</td>"
Rs.MoveNext
End If
If Cels<>1 And II<>Cels Then
StrTmp = StrTmp & "<td>&nbsp;</td>"
End If
Next
StrTmp = StrTmp & "</tr>"  
Loop
Rs.Close 
StrTmp = StrTmp & "</table>"
Response.Write(StrTmp)
End Sub



------------------------------------------------------
我要得效果是标题在左边,时间在右边,可是现在的效果是标题在上边,时间在下一行,而且是左对齐

------解决方案--------------------
改成
StrTmp = StrTmp & "<span>"
If DisHits Then
StrTmp = StrTmp & " 查看:" & Rs("Hits")
End If
If DisTime Then
StrTmp = StrTmp & " " & Format_Time(Rs("AddTime"),TimeFormat)
End If
StrTmp = StrTmp & "</span></div>"


放在</div>里面