我很抱歉,但這種做法不會與大多數的瀏覽器工作,這是一個安全問題,你只能使用URI的爲IMG.src 你可以做的是導航到文件本身並使其可見,如果你需要在頁面上的其他東西,你將不得不在另一個框架中。
這是我採用的腳本來顯示我的位置c:驅動器的圖像。有了show sub,你可以顯示文字,但不是你的IMG
dim oIe
InitIE 500, 500
oIe.navigate "file:///C|/Users/peter/butterfly.png"
'--- ---'
Sub InitIE(iWidth,iHeight)
Dim iLeft, iTop
On error resume next
Set oIe = WScript.CreateObject("InternetExplorer.Application", "IE_")
If Err.Number <> 0 Then
WScript.CreateObject("WScript.Shell").Popup("Error:" & Err.description)
Wscript.Quit
Else
With oIe
.Visible = False
.TheaterMode = True
.FullScreen = True
iLeft = (.width - iWidth)/2
iTop = (.Height - iHeight)/2
.FullScreen = False
.TheaterMode = False
.MenuBar = True
.ToolBar = False
.StatusBar = True
.AddressBar = False
.navigate "about:blank"
.Width = iWidth
.Height = iHeight
.Left = iLeft
.Top = iTop
.Resizable = True
.Visible = True
.document.focus()
End With
End If
End Sub
'--- ---'
Sub Show(ByVal sText)
If IEReady() Then
oIe.Document.body.innerHTML = oIe.Document.body.innerHTML & sText & "<br>"
iLengte = iLengte + 300
oIe.Document.parentWindow.scroll 0, iLengte
End If
End Sub
'--- ---'
Function IEReady()
IEReady = False
If TypeName(oIe) <> "Object" Then
If oIe.ReadyState = 4 Then
IEReady = True
End If
End If
End Function
'--- ---'
Sub CloseIE
oIe.Quit
Set oIe = Nothing
End Sub