Scripting.FileSystemObject#default#download
解决方案 »
- 一个截取字符串的问题,大虾帮帮忙?
- javascript获取屏幕象素的问题
- |zyciis| 如何用jquery判断一个对像是否已经包含了某个CSS,谢谢
- |zyciis| 如何来设置table中的td的宽,我用clientWidth FireFox提示:property that has only a gette
- 屏蔽层变灰
- 2级连动怎么写
- 如何在服务器端重写js???
- 调用图片链接的一个问题,请大家帮帮忙。
- 在网页中如何判断一个<button>按钮被点击过,根据是否被点击在做相应操作。
- window.event.srcElement这个对象什么意思
- 在关闭子窗口的同时,怎么才能刷新父窗口?
- 如何计算某年某月的天数和每天对应的星期
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head><body><form name=frm>
请选择一个TXT文件:<input type=file name=theFile><input type=button value=确定 name="NowOK" onclick="getContent()"><br>
<textarea name=theFileContent rows="15" cols="50" style="display:true">
</textarea>
</form></body></html>
<script language=javascript>
function getContent()
{
if (frm.theFile.value.length<4||frm.theFile.value.search(/\.txt$/i)<1)
{
alert("没有选择文件或所选择的文件不是TXT文件");
return;
}
try
{
var fso, f
fso=new ActiveXObject("Scripting.FileSystemObject");
f=fso.OpenTextFile(frm.theFile.value,1);
document.all("theFileContent").innerText="";
var theContent="";
for (var i=0;i<10000;i++) //内容太多的话将只读到第10000行
{
try { theContent+=f.ReadLine()+"\n"; }
catch(Exception){ break; }
}
document.all("theFileContent").innerText=theContent;
}
catch(Exception){alert("请输入正确的文件");}}</script>