JAvascriptファイル操作

25371 ワード

JAvascriptファイル操作

  
:

javascript
javascript
spilt



javascript
<! DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN " " http://www.w3.org/TR/html4/loose.dtd " >
< html >
< head >
< title > New Document < / title>
< meta name = " Generator " content = " EditPlus " >
< meta name = " Author " content = "" >
< meta name = " Keywords " content = "" >
< meta name = " Description " content = "" >
< script type = " text/javascript " >
<!--
function ReadTxt(file,oTxt){
var path = file.value ;
var fso = new ActiveXObject( " Scripting.FileSystemObject " );
var f = fso.OpenTextFile(path, 1 );
oTxt.value
= f.ReadAll(); // document.write(f.ReadAll());
}
// -->
< / script>
< / head>
< body >
< form >
< input type = " file " name = " file1 " > < input type = button onclick = " ReadTxt(file1,txt) " value = " Read " > < br >< br >< br >
< textarea rows = " 10 " cols = " 100 " name = " txt " > < / textarea>
< / form>
< / body>
< / html>



javascript
<! DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN " " http://www.w3.org/TR/html4/loose.dtd " >
< html >
< head >
< title > New Document < / title>
< meta name = " Generator " content = " EditPlus " >
< meta name = " Author " content = "" >
< meta name = " Keywords " content = "" >
< meta name = " Description " content = "" >
< script type = " text/javascript " >
<!--
function buildnew(){
var fso = new ActiveXObject( " Scripting.FileSystemObject " );
var f1 = fso.createtextfile( " d:\
ew.txt
" , true );
}
// -->
< / script>
< / head>
< body >
< form >
< input type = button onclick = " buildnew() " value = " new " >
< / form>
< / body>
< / html>


spilt
<! DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN " " http://www.w3.org/TR/html4/loose.dtd " >
< html >
< head >
< title > New Document < / title>
< meta name = " Generator " content = " EditPlus " >
< meta name = " Author " content = "" >
< meta name = " Keywords " content = "" >
< meta name = " Description " content = "" >
< script type = " text/javascript " >
<!--
function buildnew(){
var str = " How are you doing today? "

document.write(str.split(
" " ) + " <br /> " )
document.write(str.split(
"" ) + " <br /> " )
document.write(str.split(
" " , 3 ))
}
// -->
< / script>
< / head>
< body >
< form >
< input type = button onclick = " buildnew() " value = " new " >
< / form>
< / body>
< / html>