javescript代码转vb..

来源:百度知道 编辑:UC知道 时间:2024/06/05 19:42:09
下面的代码怎么转成vb的???
<script language="JavaScript">
function doDocument(doc)
{
try
{
if (doc.selection.createRange().htmlText.length)
{
prompt("Selection Area Code:",doc.selection.createRange().htmlText);
return;
}
var frs=doc.frames;
if (frs != null && frs.length>0)
{
for (var i=0; i < frs.length; i++)
{
doDocument(frs[i].document);
}
}
}catch(e){}
}
doDocument(document);
</script>

...或者直接告诉我vb还有什么方法查看选定区域源代码

Function doDocument(doc)
If Len(doc.selection.createRange().htmlText) > 0 Then
MsgBox doc.selection.createRange().htmlText, , "Selection Area Code:"
Exit Function
End If
Dim frs, i As Integer
Set frs = doc.frames
If (Not frs Is Nothing) And frs.length > 0 Then
For i = 0 To frs.length - 1
doDocument (frs(i).Document)
DoEvents
Next
End If
End Function