我正在尝试在HTML中使用[objshell browseforfolder
]和vbs来创建文件夹浏览器。它在hta中运行正常但是当我把它放到html页面时,它总是告诉我许可被拒绝。我对此做了一些研究,看起来IE不支持文件夹浏览的安全原因.....所以我的问题是,无论如何要使其工作?我在内部页面上使用它,所以安全性不会成为问题.....
以下是代码:
<html>
<head>
<script language = "VBScript">
Sub ChooseSaveFolder_OnClick()
strStartDir = "c:\work"
userselections.txtFile.value = PickFolder(strStartDir)
End Sub
Function PickFolder(strStartDir)
Dim SA, F
Set SA = CreateObject("Shell.Application")
Set F = SA.BrowseForFolder(0, "Choose a folder", 0, strStartDir)
If (Not F Is Nothing) Then
PickFolder = F.Items.Item.path
End If
Set F = Nothing
Set SA = Nothing
End Function
</script>
</head>
<body>
<form name="userselections">
<input type = "text" name = "txtFile" size="50" />
<input type = "button" value = "Browse ..." Name="ChooseSaveFolder">
</form>
</body>
</html>