2 回答

TA貢獻2065條經驗 獲得超14個贊
我覺得我是找到原因了,http://sx.zsedu.net/頁面內容里有單獨出現的">",如語句:if(dypopLayer.filters.Alpha.opacity>0)中就含有單獨的">",故pos1與pos2并不是如你想像中那樣完全配套的!
修改也很簡單,程序不需要太大變化,只需要把
pos1=1
do while pos1 > 0
%>
<%
pos1 = InStr(1, strContent, "<", vbTextCompare)
pos2 = InStr(1, strContent, ">", vbTextCompare)
if pos1 > 0 and pos2 > 1 then
title = Mid( strContent, pos1, pos2 - pos1+1 )
strContent=Replace(strContent,title,"")
end if
%>
<%
loop
%>
改為:
pos1=1
pos2=1
do while pos1 > 0
%>
<%
pos1 = InStr(1, strContent, "<", vbTextCompare)
pos2 = InStr(pos2+1, strContent, ">", vbTextCompare)
if pos1 > 0 and pos2 > 1 and pos2 > pos1 then
title = Mid( strContent, pos1, pos2 - pos1+1 )
strContent=Replace(strContent,title,"")
pos2=1
end if
%>
<%
loop
%>

TA貢獻1818條經驗 獲得超11個贊
Mid函數是從第一個字符開始取值的
如果 pos1 = InStr(1, strContent, "<", vbTextCompare) 這句話得到的POS1小于1的話,程序Mid函數當然就會報錯了
添加回答
舉報