请问如果用javascript弹出像VB那样的公共对话框来选择文件? 不是用来上传文件,而是用来保存文件到本地,所以应该不能用<input type=file>吧,有控件可以实现吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <OBJECT id="fileDialog" codeBase="http://activex.microsoft.com/controls/vb5/comdlg32.cab" height="0px" width="0px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" VIEWASTEXT> <PARAM NAME="_ExtentX" VALUE="847"> <PARAM NAME="_ExtentY" VALUE="847"> <PARAM NAME="_Version" VALUE="393216"> <PARAM NAME="CancelError" VALUE="0"> <PARAM NAME="Color" VALUE="0"> <PARAM NAME="Copies" VALUE="1"> <PARAM NAME="DefaultExt" VALUE=""> <PARAM NAME="DialogTitle" VALUE=""> <PARAM NAME="FileName" VALUE=""> <PARAM NAME="Filter" VALUE=""> <PARAM NAME="FilterIndex" VALUE="0"> <PARAM NAME="Flags" VALUE="0"> <PARAM NAME="FontBold" VALUE="0"> <PARAM NAME="FontItalic" VALUE="0"> <PARAM NAME="FontName" VALUE=""> <PARAM NAME="FontSize" VALUE="8"> <PARAM NAME="FontStrikeThru" VALUE="0"> <PARAM NAME="FontUnderLine" VALUE="0"> <PARAM NAME="FromPage" VALUE="0"> <PARAM NAME="HelpCommand" VALUE="0"> <PARAM NAME="HelpContext" VALUE="0"> <PARAM NAME="HelpFile" VALUE=""> <PARAM NAME="HelpKey" VALUE=""> <PARAM NAME="InitDir" VALUE=""> <PARAM NAME="Max" VALUE="0"> <PARAM NAME="Min" VALUE="0"> <PARAM NAME="MaxFileSize" VALUE="260"> <PARAM NAME="PrinterDefault" VALUE="1"> <PARAM NAME="ToPage" VALUE="0"> <PARAM NAME="Orientation" VALUE="1"> </OBJECT> fileDialog.ShowOpen();fileDialog.ShowSave() 正好前几天写了一个。(用了CommonDialog控件,我的机子上(Win2K,vb6)测试通过)<object classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" id="CommonDialog1" width="0" height="0"></object><form> <p> <select name="Select1" size="2" style="width:400;height:150;"> <option value=""></option> </select> <br> 选择的文件共:<input name="Text1" size="3" readOnly value="0">个 <input type="button" value=" 选择文件... " name="B3" onclick="VBScript:SelectMutipleFiles"> </p></form><script language="VBScript">Function NewOption(s) set NewOption = document.createElement("Option") NewOption.text = s NewOption.value = sEnd FunctionSub SelectMutipleFiles With CommonDialog1 .DialogTitle = "选择您要上传的文件" .FileName = "" '清空原来的选择 .MaxFileSize = 1024 * 4 '存储文件名字符串所需内存 .Flags = &H200 + &H80000 '允许多选,允许长文件名 .Filter="所有文件(*.*)|*.*|老崔文件(*.cxp)|*.cxp|文本文件(*.txt)|*.txt" .ShowOpen End With document.forms(0).Select1.options.length = 0 document.forms(0).Text1.value = 0 dim FileNames, I FileNames = Split(CommonDialog1.FileName, Chr(0)) document.forms(0).Text1.value = (UBound(FileNames)+1) If UBound(FileNames)=0 Then document.forms(0).Select1.options.add NewOption(FileNames(I)) Else For I=1 To UBound(FileNames) FileNames(I)=FileNames(0) & "\" & FileNames(I) document.forms(0).Select1.options.add NewOption(FileNames(I)) Next End ifEnd Sub</script> 京东分类下拉菜单谁有? 开始就收缩型的,不是开始就展开型的 jquery的提示框怎么弄啊 jquery合并拆分表格 用jquery实现的三级联动菜单,如何刷新时加载默认的选项! google map api GDirections 计算行程报api错误 JS页面定时画笔 多级连动返回值怎么实现阿? 郁闷,FF下为什么不支持pixelWidth,用啥能代替的? iis打开默认index.htm通过form提交给另一个htm文件怎么实现? 求个jquery封装,加载动画始终居中显示,代码已有,不会封装 保持窗口总是最前出现的问题! 关于hidden的传值问题
height="0px" width="0px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="847">
<PARAM NAME="_ExtentY" VALUE="847">
<PARAM NAME="_Version" VALUE="393216">
<PARAM NAME="CancelError" VALUE="0">
<PARAM NAME="Color" VALUE="0">
<PARAM NAME="Copies" VALUE="1">
<PARAM NAME="DefaultExt" VALUE="">
<PARAM NAME="DialogTitle" VALUE="">
<PARAM NAME="FileName" VALUE="">
<PARAM NAME="Filter" VALUE="">
<PARAM NAME="FilterIndex" VALUE="0">
<PARAM NAME="Flags" VALUE="0">
<PARAM NAME="FontBold" VALUE="0">
<PARAM NAME="FontItalic" VALUE="0">
<PARAM NAME="FontName" VALUE="">
<PARAM NAME="FontSize" VALUE="8">
<PARAM NAME="FontStrikeThru" VALUE="0">
<PARAM NAME="FontUnderLine" VALUE="0">
<PARAM NAME="FromPage" VALUE="0">
<PARAM NAME="HelpCommand" VALUE="0">
<PARAM NAME="HelpContext" VALUE="0">
<PARAM NAME="HelpFile" VALUE="">
<PARAM NAME="HelpKey" VALUE="">
<PARAM NAME="InitDir" VALUE="">
<PARAM NAME="Max" VALUE="0">
<PARAM NAME="Min" VALUE="0">
<PARAM NAME="MaxFileSize" VALUE="260">
<PARAM NAME="PrinterDefault" VALUE="1">
<PARAM NAME="ToPage" VALUE="0">
<PARAM NAME="Orientation" VALUE="1">
</OBJECT>
fileDialog.ShowSave()
(用了CommonDialog控件,我的机子上(Win2K,vb6)测试通过)<object classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" id="CommonDialog1" width="0" height="0"></object>
<form>
<p>
<select name="Select1" size="2" style="width:400;height:150;">
<option value=""></option>
</select>
<br>
选择的文件共:<input name="Text1" size="3" readOnly value="0">个
<input type="button" value=" 选择文件... " name="B3" onclick="VBScript:SelectMutipleFiles">
</p>
</form>
<script language="VBScript">
Function NewOption(s)
set NewOption = document.createElement("Option")
NewOption.text = s
NewOption.value = s
End Function
Sub SelectMutipleFiles
With CommonDialog1
.DialogTitle = "选择您要上传的文件"
.FileName = "" '清空原来的选择
.MaxFileSize = 1024 * 4 '存储文件名字符串所需内存
.Flags = &H200 + &H80000 '允许多选,允许长文件名
.Filter="所有文件(*.*)|*.*|老崔文件(*.cxp)|*.cxp|文本文件(*.txt)|*.txt"
.ShowOpen
End With
document.forms(0).Select1.options.length = 0
document.forms(0).Text1.value = 0
dim FileNames, I
FileNames = Split(CommonDialog1.FileName, Chr(0))
document.forms(0).Text1.value = (UBound(FileNames)+1)
If UBound(FileNames)=0 Then
document.forms(0).Select1.options.add NewOption(FileNames(I))
Else
For I=1 To UBound(FileNames)
FileNames(I)=FileNames(0) & "\" & FileNames(I)
document.forms(0).Select1.options.add NewOption(FileNames(I))
Next
End if
End Sub
</script>