源文件已经指定,例如:var sPath = "c:\\ccb\\txrem.txt";
大概过程是这样:点击按钮-->弹出另存为对话框-->选择要保存的路径-->保存文件
大概过程是这样:点击按钮-->弹出另存为对话框-->选择要保存的路径-->保存文件
解决方案 »
- 怎么样显示一个随机数?
- 调用 其他iframe里的元素
- 求教关于浏览器地址栏注入的小技巧
- JAVASCRIPT与VBSCRIPT怎么交互使用?最好能举例说明!谢谢
- 有一个问题: 我用photoshop 批处理自动生成了一个生成了一个带frame的网页index.htm 和很多有序号的子网页(作用是 通过右边的网页图标
- 谁能帮我写个这样的JS??
- Table中row的复制问题!
- marquee问题
- 这个函数怎么用JS写?
- 如何在网站里面加入流量统计功能,要记录到访时间、IP等信息?
- javascript的语种系统决定吗,如confirm弹出确定取消,我想改成英文的确定或取消,如何处理呢,程序中可以设置吗
- 请教,asp如何取javascript里面的值
JS默认权限是无法使用FSO对像,如果一定要用的话要降低IE安全级别,
</object>
<textarea id=TxtBody style="background-color:#EEEEEE;width:100%;height:100">无标题</textarea>
<br>
<input type=button value=加载 onclick="loadDoc()">
<input type=button value=保存 onclick="saveDoc()">
<script>
function loadDoc()
{
fileDialog.CancelError=true;
try{
fileDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt";
fileDialog.ShowOpen();
var fso=new ActiveXObject("Scripting.FileSystemObject");
var reading=1;
var f=fso.OpenTextFile(fileDialog.filename,reading);
//window.confirm(f);
var r=f.ReadAll();
f.close();
TxtBody.value=r;
}catch(e){}
}
function saveDoc()
{
fileDialog.CancelError=true;
try{
fileDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt";
fileDialog.ShowSave();
var fso=new ActiveXObject("Scripting.FileSystemObject");
var f=fso.CreateTextFile(fileDialog.filename,true);
f.write(TxtBody.value);
f.Close();
}
catch(e){}
}
</script>
</body>
这段程序在xp系统下可以正常运行。
function hehe()
{
var filePath = document.getElementById("filePath");
alert(filePath.value);
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f1 = fso.CopyFile("c:\\Test.txt", "c:\\logs\\");
}
</script>
<input type="file" id="filePath" />
<input type="button" value="Test" onclick="hehe();" />只能指定路径,由于input type="file"无法选择文件夹,期待高手回答