<script language=vbscript>
dim c=0 ;
Function GetBytes2BSTR(p_sHtmlStr)
dim sReturnStr ;
dim i,n ;
sReturnStr = ""
n = LenB(p_sHtmlStr) ;
For i = 1 To n ;
dim sCharCode ;
dim sNextCharCode ;
sCharCode = AscB( MidB(p_sHtmlStr, i, 1) ) ;
If (sCharCode < &H80) Then
sReturnStr = sReturnStr & Chr(sCharCode)
Else
sNextCharCode = AscB( MidB(p_sHtmlStr, i+1, 1) )
sReturnStr = sReturnStr & Chr(CLng(sCharCode) * &H100 + CInt(sNextCharCode))
i = i + 1
End If
Next
GetBytes2BSTR = sReturnStr ;
End Function
Function getData(strUrl)
Dim xmlhttp
Set xmlhttp=CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "get",strUrl,false
xmlhttp.send
getData=GetBytes2BSTR(xmlhttp.responseBody)
End Function
Function test(url)
alert url
Dim strurl,strHTML,oTables,oTable
strHTML=getData(url)
If(c==0) Then
getLrc.hid= strHTML
c++
check()
Else
lrcbox.innerHTML=strHTML
End If
Next
End Function
Function here(s)
alert s
End Function
</script>
第一次用vb
运行时报错:语句未结束!
到底哪里未结束啊!高手指点
------解决方案--------------------------------------------------------
- VBScript code
Dim c : c = 0Function GetBytes2BSTR(p_sHtmlStr) dim sReturnStr dim i,n sReturnStr = "" n = LenB(p_sHtmlStr) dim sCharCode dim sNextCharCode For i = 1 To n sCharCode = AscB(MidB(p_sHtmlStr, i, 1)) If (sCharCode < &H80) Then sReturnStr = sReturnStr & Chr(sCharCode) Else sNextCharCode = AscB(MidB(p_sHtmlStr, i+1, 1)) sReturnStr = sReturnStr & Chr(CLng(sCharCode) * &H100 + CInt(sNextCharCode)) i = i + 1 End If Next GetBytes2BSTR = sReturnStrEnd FunctionFunction getData(strUrl) Dim xmlhttp Set xmlhttp = CreateObject("Microsoft.XMLHTTP") xmlhttp.open "get",strUrl,false xmlhttp.send getData=GetBytes2BSTR(xmlhttp.responseBody) End Function Function test(url) Dim strurl,strHTML,oTables,oTable strHTML = getData(url) If c = 0 Then 'getLrc.hid = strHTML c = c + 1 check Else lrcbox.innerHTML = strHTML End IfEnd Function Function here(s) MsgBox sEnd Function