Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code for fengshui1998 from abhayrao

Status
Not open for further replies.

abhayrao

Technical User
Nov 5, 2002
16
0
0
IN
fengshui1998,you wanted to see my code.Here it is:-
<html>
<script language=&quot;VBScript&quot;>
function save()
Dim oFS, writefile
Set oFS = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set writefile= oFS.OpenTextFile(&quot;c:\a.txt&quot;,true)
writefile.write(S1.value)
writefile.close
end function
function open()
Dim oFS, readfile
Set oFS = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set readfile= oFS.OpenTextFile(&quot;c:\a.txt&quot;,true)
readfile.ReadAll
readfile.close
end function
</script>
<body>
<textarea rows=&quot;20&quot; name=&quot;S1&quot;
cols=&quot;80&quot;></textarea><br>
<input type=&quot;button&quot; id=&quot;save&quot;
value=&quot;Save&quot; onClick=&quot;save()&quot;>
<input type=&quot;button&quot; id=&quot;open&quot;
value=&quot;Open&quot; onClick=&quot;open()&quot;>
</body>
</html>
can you tell what the problem is and how to handle the &quot;bad file mode&quot; error?
 
Try this code,

<html>
<head>
<script language=&quot;VBScript&quot;>
function save1()
Dim oFS, writefile
Set oFS = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set writefile= oFS.CreateTextFile(&quot;c:\output1.txt&quot;)
writefile.writeline(document.xxx.S1.value)
writefile.close
end function

function open1()
Dim oFS, readfile
Set oFS = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set readfile= oFS.OpenTextFile(&quot;c:\output1.txt&quot;,true)
readfile.ReadAll
readfile.close
end function
</script>

</head>
<body>
<form name=&quot;xxx&quot;>
<textarea rows=&quot;20&quot; name=&quot;S1&quot; cols=&quot;80&quot;></textarea><br>
<input type=&quot;button&quot; id=&quot;savex&quot; value=&quot;Save&quot; onClick=&quot;save1()&quot;>
<input type=&quot;button&quot; id=&quot;openx&quot; value=&quot;Open&quot; onClick=&quot;open1()&quot;>
</form>
</body>
</html>


fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top