白开心

  IT博客 :: 首页 ::  :: 联系 :: 聚合  :: 管理 ::
  9 随笔 :: 76 文章 :: 28 评论 :: 0 Trackbacks

<%

Server.ScriptTimeout = 120
 function getHTTPPage(url)
  on error resume next
  dim http
  set http=Server.createobject("Microsoft.XMLHTTP")
  Http.open "GET",url,false
  Http.send()
  if Http.readystate<>4 then
   exit function
  end if
  getHTTPPage=bytes2BSTR(Http.responseBody)
  set http=nothing
  if err.number<>0 then err.Clear 
 end function

 Function bytes2BSTR(vIn)
  dim strReturn
  dim i1,ThisCharCode,NextCharCode
  strReturn = ""
  For i1 = 1 To LenB(vIn)
   ThisCharCode = AscB(MidB(vIn,i1,1))
   If ThisCharCode < &H80 Then
    strReturn = strReturn & Chr(ThisCharCode)
   Else
    NextCharCode = AscB(MidB(vIn,i1+1,1))
    strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
    i1 = i1 + 1
   End If
  Next
  bytes2BSTR = strReturn
 End Function
 
 Function GetMid(txt,StrOne,StrTwo)
 NumOne = Instr(txt,StrOne)
 NumTwo = Instr(txt,StrTwo)
 if NumOne=0 or NumTwo=0 Then GetMid="":Exit Function
 GetMid = Mid(txt,NumOne+Len(StrOne),NumTwo-NumOne-Len(StrOne))
 End Function
 
 Dim htmSource
 htmSource=Left(getHTTPPage("http://www.hunnu.edu.cn/hnsd/xnxw/"),10000)
 
 Dim newArray,iArray
 newArray = Split(htmSource,".htm' >")
%>
<table width="664" border="0" align="center" style="border-collapse:">
 <%
  For i=1 to 15
  if i= ubound(newArray) Then exit for
 %>
 <tr>
  <td align="left">&nbsp;&nbsp;
  <img src="Images/home_tb.jpg" border="0">&nbsp;
   <a href="ShowNews.Asp?id=<% =Right(newArray(i-1),14) %>" target="_blank"><%=Left(newArray(i),instr(newArray(i),"</TD>")-1)%></a>
  </td>
 </tr>
 <%
 Next
 %>
</table>

posted on 2005-12-26 21:29 白开心 阅读(1585) 评论(0)  编辑 收藏 引用 所属分类: Asp+vbScript
只有注册用户登录后才能发表评论。