能否让嵌入的IE浏览器载入一段html的字符串?
通过以下的方法可以载入一个URL的网页,$oIE.navigate("http://www.autoitx.com")
是否有什么方法可以载入的不是URL而是一段字符串?
比如 $oIE.xxxx("<html><body>xxxx</body></html>")#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Example()
; 简单示例: 嵌入Internet Explorer对象到 AutoIt GUI
;
; 参见: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp
Func Example()
Local $oIE, $GUI_Button_Back, $GUI_Button_Forward
Local $GUI_Button_Home, $GUI_Button_Stop, $msg
$oIE = ObjCreate("Shell.Explorer.2")
; 为输出创建一个简单的 GUI
GUICreate("嵌入 Web 控件测试", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("返回", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("向前", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("主页", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("停止", 330, 420, 100, 30)
GUISetState() ;显示 GUI
;$oIE.navigate("http://www.autoitx.com")
$oIE.navigate("<pre>aaa</pre>")
; 等待用户关闭窗口
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Button_Home
$oIE.navigate("http://www.autoitx.com")
Case $msg = $GUI_Button_Back
$oIE.GoBack
Case $msg = $GUI_Button_Forward
$oIE.GoForward
Case $msg = $GUI_Button_Stop
$oIE.Stop
EndSelect
WEnd
GUIDelete()
EndFunc ;==>Example #include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Example()
; 简单示例: 嵌入Internet Explorer对象到 AutoIt GUI
;
; 参见: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp
Func Example()
Local $oIE, $GUI_Button_Back, $GUI_Button_Forward
Local $GUI_Button_Home, $GUI_Button_Stop, $msg
$oIE = ObjCreate("Shell.Explorer.2")
; 为输出创建一个简单的 GUI
GUICreate("嵌入 Web 控件测试", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("返回", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("向前", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("主页", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("停止", 330, 420, 100, 30)
GUISetState() ;显示 GUI
$oIE.navigate("about:blank")
;$oIE.navigate("<pre>aaa</pre>")
$oIE.document.body.innerhtml="<font color=red>Test OK!!!</font>"
; 等待用户关闭窗口
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Button_Home
$oIE.navigate("http://www.autoitx.com")
Case $msg = $GUI_Button_Back
$oIE.GoBack
Case $msg = $GUI_Button_Forward
$oIE.GoForward
Case $msg = $GUI_Button_Stop
$oIE.Stop
EndSelect
WEnd
GUIDelete()
EndFunc ;==>Example先打开空白页,再写入html文本即可
页:
[1]