一个打开本地文件和保存到本地文件的html代码,但是有个bug
asert 2010-01-16 11:50:12 <HTML XMLNS:IE>
<body>
<SCRIPT>
function onDownloadDone(s) {
content.value=s; //设置文本框的内容
}
function Save(){
var txt = document.all.content.value;
b = window.open("", "", "height=1, width=1, toolbar= no, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=1000,left=200");
b.document.open();
b.document.write(txt);
b.document.close();
b.document.execCommand('saveas',true,'');
b.window.close();
}
</SCRIPT>
<textarea name="content" cols=50 rows=4></textarea>
<div ID="oDownload" STYLE="behavior:url(#default#download)" />
<input type=file name='myfile'>
<input type=button value="Open" onclick="oDownload.startDownload(myfile.value,onDownloadDone)">
<input type="button" value="Save" class="trans" onclick="Save()">
</body>
</html>
以上是一个可以在IE中打开本地文件和保存到本地文件的html代码,但是保存有问题,保存的编码只能是unicode,导致再打开保存后的文件显示在textarea中会显示不出来,请问如何解决这个问题?或者有更好的打开保存本地文件的html代码吗?
谢谢