writing user input to file, and concatenating multiple user input to be displayed on webpage
<html><head>
<script language="javascript">
function Writedata()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var write_id;
write_id = document.getElementById('write_id').value ;
alert('The data has been written to \n' + write_id);
var s = fso.CreateTextFile(write_id, true);
s.WriteLine(document.getElementById('name_id').value);
s.WriteLine(document.getElementById('id_id').value);
s.Close();
}
</script>
</head>
<body>
name : <input type="text" name="name" value="" id="name_id"><br/>
Address : <input type="text" name="id" value="" id="id_id"><br/>
Write file to : <input type="text" name="write" value="" id="write_id"><br/>
<input type="button" onclick="Writedata()" value="submit">
</body>
</html>
this is a workable page and can be tried out for hands on feel ..... but do not forget to enable the ActiveX scripting from tools->internet options->security tab->custom level
soumya sen
Friday, June 22, 2007
*************
I quoted from 'soumya sen', because I tried the code, and it works.
But, i am only able to write data from one user, and when another user inputs data, the former/prior users data gets deleted when I refresh the destination writeto page.
I want the user input to be displayed as it is inputted, over time.
So, one user inputs data, and the next user inputs data, and the next user inputs data, etc.... and all of that data gets written to the webpage destination, and I can display it in orderly fashion.
How do I make the data in the writtento destination file, sort of concatentate so that I don't lose user input data???
I would want to separate one users data from another users data, perhaps with a semicolon (;). Anyone know?
Preferably, if anyone knows, I hope it is some relatively simple modification to soumya sens code that I copied above.
Please help.
<script language="javascript">
function Writedata()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var write_id;
write_id = document.getElementById('write_id').value ;
alert('The data has been written to \n' + write_id);
var s = fso.CreateTextFile(write_id, true);
s.WriteLine(document.getElementById('name_id').value);
s.WriteLine(document.getElementById('id_id').value);
s.Close();
}
</script>
</head>
<body>
name : <input type="text" name="name" value="" id="name_id"><br/>
Address : <input type="text" name="id" value="" id="id_id"><br/>
Write file to : <input type="text" name="write" value="" id="write_id"><br/>
<input type="button" onclick="Writedata()" value="submit">
</body>
</html>
this is a workable page and can be tried out for hands on feel ..... but do not forget to enable the ActiveX scripting from tools->internet options->security tab->custom level
soumya sen
Friday, June 22, 2007
*************
I quoted from 'soumya sen', because I tried the code, and it works.
But, i am only able to write data from one user, and when another user inputs data, the former/prior users data gets deleted when I refresh the destination writeto page.
I want the user input to be displayed as it is inputted, over time.
So, one user inputs data, and the next user inputs data, and the next user inputs data, etc.... and all of that data gets written to the webpage destination, and I can display it in orderly fashion.
How do I make the data in the writtento destination file, sort of concatentate so that I don't lose user input data???
I would want to separate one users data from another users data, perhaps with a semicolon (;). Anyone know?
Preferably, if anyone knows, I hope it is some relatively simple modification to soumya sens code that I copied above.
Please help.
amre stadder
November 24,