首先对于坏标题感到抱歉,如果任何人都可以更好地说出这个问题,请做。HTML文件输入表单显示与VBScript不同的选定文件的整个路径
我有这个HTML文件:
<html>
<form action='' method='post'>
<input id='inbox' type='file' />
<input id='outbox' type='button' onclick='alert(inbox.value);'
value='submit' />
</form>
</html>
,当我与IE浏览器打开它,然后浏览文件,然后点击“提交”按钮,我用全路径选择的文件警告。但是,如果我尝试相同的脚本使用VBScript:
Set IE = CreateObject("InternetExplorer.Application")
IE.Offline = True
IE.Navigate "about:blank"
Do
Loop While IE.Busy
html = "<html>" &_
" <form action='' method='post'>" &_
" <input id='inbox' type='file' />" &_
" <input id='outbox' type='button' onclick='alert(inbox.value);'" &_
" value='submit' />" &_
" </form>" &_
"</html>"
IE.Document.write html
IE.Width = 0
IE.Height = 0
IE.Document.All("inbox").Click
IE.Document.All("outbox").Click
我提醒与臭名昭著的c:\fakepath\file.ext
消息。
有没有人有一个想法,为什么这是甚至更好的如何克服它?
感谢64bit提示。 – theta 2013-02-18 11:05:42