<% '---------------------------------------------------------------------- '查询数据库,获得记录集 '---------------------------------------------------------------------- Sql_Type = "Select top 2 * From [resource_type] Where [IsValid] = 1 And [Style] = 1 Order By [SortOrder]" set Rs_Type = Server.CreateObject("Adodb.RecordSet") Rs_Type.open Sql_Type, conn, 1, 1 set TypeID = Rs_Type("ID") 'Response.Write(Rs2.RecordCount) 'Response.End() Sql_Type2 = "Select * From [resource_type] Where [IsValid] = 1 And [Style] = 2 Order By [SortOrder]" set Rs_Type2 = Server.CreateObject("Adodb.RecordSet") Rs_Type2.open Sql_Type2, conn, 1, 1 set TypeID2 = Rs_Type2("ID") '---------------------------------------------------------------------- %> <% '---------------------------------------------------------------------- '定义函数,将整个程序放在函数体内 Function LoadResourceStyle1(intTypeID) Sql1 = "Select top 1 * From [resource] Where [TypeID] = "&intTypeID&" And [IsValid] = 1 And [IsFocus] = 1 Order By [LastUpdateTime] Desc" 'Response.Write(Sql1) 'Response.End() set Rs1 = Server.CreateObject("Adodb.RecordSet") Rs1.open Sql1, conn, 1, 1 Sql2 = "Select top 9 * From [resource] Where [TypeID]= "&intTypeID&" And [IsValid] = 1 And [IsFocus] = 0 Order by [LastUpdatetime] desc" set Rs2 = Server.CreateObject("Adodb.RecordSet") Rs2.open Sql2, conn, 1, 1 %>
<%=Rs_Type("ResourceType")%>
<%If Rs1.Eof = True Then %>
暂时没有数据!
<%Else%>
<% dim strPicName '文件名 dim strExtendName '扩展名 dim CheckPicName '区分html标签 strPicName = Rs1("PicName") lenght = 4 strExtendName = Right(strPicName,lenght) If strExtendName = ".swf" Then CheckPicName = "" Elseif strExtendName = ".jpg" or strExtendName = ".gif" Then CheckPicName = "" Else CheckPicName = "" End If %>
" target="_blank"><%=CheckPicName%>
" title="<%=Server.HTMLEncode(Rs1("Title"))%>" target="_blank" class="a_w_g"><%=Left(Rs1("Title"),13)%>
<%=Left(Rs1("Summary"),54)%>
<%End If%>
<%If Rs2.Eof = True Then%>
暂时没有数据!
<%Else%> <% for i = 1 to 9 %> <% date1 = Rs2("LastUpdateTime") date2 = Date() compare = DateDiff("d",date1,date2) If compare <= 3 Then srtLastUpdateTime = " " 'Response.Write(" 现在") Else srtLastUpdateTime = " " 'Response.Write(" ") End If 'dim checklen,strTitle,showTitle 'strTitle = Rs2("Title") 'checklen = len(strTitle) 'If checklen > 20 Then ' showTitle = left(strTitle,18)&"..." 'Else ' showTitle = strTitle 'End If 'Response.Write() strTitle = Rs2("Title") arrStr1 = strTitle showTitle = SubString(arrStr1, 38) %>
&TypeID=<%=Rs2("TypeID")%>" class="a_news_list_links" target="_blank" title="<%=Server.HTMLEncode(Rs2("Title"))%>"><%=Server.HTMLEncode(showTitle)%><%=srtLastUpdateTime%>  
<% Rs2.MoveNext if (Rs2.eof) then exit for end if next %> <%End If%>
<% End Function %> <% Function LoadResourceStyle2(intTypeID) Sql3 = "Select top 1 * From [resource] Where [TypeID] = "&intTypeID&" And [IsValid] = 1 And [IsFocus] = 1 Order By [LastUpdatetime] desc" 'Response.Write(Sql1) 'Response.End() set Rs3 = Server.CreateObject("Adodb.RecordSet") Rs3.open Sql3, conn, 1, 1 Sql4 = "Select top 22 * From [resource] Where [TypeID]= "&intTypeID&" And [IsValid] = 1 And [IsFocus] = 0 Order by [LastUpdatetime] desc" set Rs4 = Server.CreateObject("Adodb.RecordSet") Rs4.open Sql4, conn, 1, 1 %>
 
<%=Rs_Type2("ResourceType")%>
 
<%If Rs3.Eof = True Then %>
暂时没有数据!
<%Else%>
<% dim strPicName '文件名 dim strExtendName '扩展名 dim CheckPicName '区分html标签 strPicName = Rs3("PicName") lenght = 4 strExtendName = Right(strPicName,lenght) If strExtendName = ".swf" Then CheckPicName = "" Elseif strExtendName = ".jpg" or strExtendName = ".gif" Then CheckPicName = "" Else CheckPicName = "" End If %>
" target="_blank"><%=CheckPicName%>
" target="_blank" class="a_w_g" title="<%=Server.HTMLEncode(Rs3("Title"))%>"><%=Left(Rs3("Title"),25)%>
<%=Left(Rs3("Summary"),81)%>
<%End If%>
<%If Rs4.Eof = True Then %>
暂时没有数据!
<%Else%> <% num = Rs4.RecordCount '每页显示的 总记录数 list = 2 '每行的列数 list_num = int(num/list) '总记录数 除以 每行的列数 等于 显示的行数 if ((num mod list) <> 0) then list_num = list_num + 1 end if for a=1 to list_num %> <% for b=1 to list %> <% Rs4.movenext if Rs4.eof or Rs4.bof then exit for '不换行,可以不写end if 'if b >= num then exit for next %> <% if Rs4.eof or Rs4.bof then exit for '不换行,可以不写end if next %>
<% date1 = Rs4("LastUpdateTime") date2 = Date() compare = DateDiff("d",date1,date2) If compare <= 3 Then srtLastUpdateTime = " " 'Response.Write(" 现在") Else srtLastUpdateTime = " " 'Response.Write(" ") End If 'dim checklen,strTitle,showTitle 'strTitle = Rs4("Title") 'checklen = len(strTitle) 'If checklen > 18 Then ' showTitle = left(strTitle,18)&"..." 'Else ' showTitle = strTitle 'End If 'Response.Write(showTitle) strTitle = Rs4("Title") arrStr1 = strTitle showTitle = SubString(arrStr1, 36) %>
&TypeID=<%=Rs4("TypeID")%>" class="a_news_list_links" target="_blank" title="<%=Server.HTMLEncode(Rs4("Title"))%>"><%=showTitle%><%=srtLastUpdateTime%>  
<%End If%>
 
<% End Function %> 网站建设·网页设计·网站设计·网站策划·北京网站建设 | 朗晨设计 - 资源库
 
关键字:
 
<%If Rs_Type.Eof = True Then%> <%Else%> <%for hot = 1 to 2%> <% Rs_Type.MoveNext if (Rs_Type.eof) then exit for end if next %> <%End If%>
  暂时没有数据!
  <% LoadResourceStyle1(TypeID) %>
 
<%If Rs_Type2.Eof = True Then%>
  暂时没有数据!
<%Else%> <%for hot2 = 1 to Rs_Type2.RecordCount%> <% LoadResourceStyle2(TypeID2) %> <% Rs_Type2.MoveNext if (Rs_Type2.eof) then exit for end if next %> <%End If%>