Integer result
oleobject objExplorer,ieDoc
objExplorer = CREATE oleobject
result = objExplorer.ConnectToNewObject( "InternetExplorer.Application")
IF result = 0 THEN
objExplorer.Navigate("about:blank")
ieDoc = objExplorer.document
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 300
objExplorer.Height = 150
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
END IF
//这个可以执行JS
oleobject WshShell
WshShell = create oleobject
WshShell.connecttonewobject( "WScript.Shell")
integer li_Return
li_Return = WshShell.Run("cscript E:\validate.js", 1, true)
messagebox("",li_return)
WshShell.DisconnectObject ( )
destroy WshShell
比如网页中有这么个函数:
<SCRIPT language=JavaScript>
function showmessage(img_name)
{
alert(img_name);
}
</SCRIPT>
PB中调用:
ole_1.object.document.parentWindow.showmessage("吞硬币的小猪");
不过注意,JavaScript的函数是区分大小写的,而PB对大小写不敏感:),因此只有网页中函数名称是小写的时候,才能够在PB中调用。
本文地址:http://com.8s8s.com/it/it19815.htm