1.使用CommandDialog作为选择对话框 2.使用FSO对象来写文件
<OBJECT id=cDialog codeBase=http://activex.microsoft.com/controls/vb5/comdlg32.cab height=0px width=0px classid=CLSID:F9043C85-F6F2-101A-A3C9-08002B2F49FB></OBJECT> <SCRIPT language=javascript> function SaveDocument(){ cDialog.CancelError=true; try{ cDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt" cDialog.ShowSave(); var fso = new ActiveXObject("Scripting.FileSystemObject"); var f = fso.CreateTextFile(cDialog.filename, true); f.write(document.body.innerHTML); f.Close(); sPersistValue=document.body.innerHTML;} catch(e){ var sCancel="true"; return sCancel;} }
</SCRIPT>
<BUTTON onclick=SaveDocument();>保存</BUTTON>

|