87,910
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript" language="javascript">
//读文件
function readFile(filename){
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.OpenTextFile(filename,1);
var s = "";
while (!f.AtEndOfStream)
s += f.ReadLine()+"/n";
f.Close();
return s;
}
//写文件
function writeFile(filename,filecontent){
var fso, f, s ;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile(filename,8,true);
f.WriteLine(filecontent);
f.Close();
alert('write ok');
}
</script>
<html>
<input type="text" id="in" name="in" />
<input type="button" value="Write!" onclick="writeFile('c:/12.txt',document.getElementById('in').value);"/>
<br><br>
<input type="button" value="Read!" onclick="document.getElementById('show').value=readFile('c:/12.txt');"/>
<br>
<textarea id="show" name="show" cols="50" rows="8" >
</textarea>
</html>
xx=1;
s();
function s(){
alert(xx);
var x=1212;
alert(x);
}
这没有问题呀,IE8,firefox都通过!xx=1;
s();
function s(){
alert(xx);
var x=1212;
alert(x);
}
能顺便帮看下 这个xx在信息窗怎么提示未定义呢,我这不是全局变量吗?