hello it's possible to write a data in a file using ActiveX control in Javascript. I have an example here i hope it will help you.
This code is able to write data in exel file. Good luck and i hope it will help you.
< script>
//This function uses ActiveX to get a forms input into a spreadsheet cell.
function xlWrite(r,c)
{
var xlApp, xlSheet;
xlApp = new ActiveXObject("Excel.Application");
xlApp.Visible = true;
xlApp.Workbooks.Add();
xlSheet = xlApp.ActiveSheet;
xlSheet.Cells(r,c).Value = frm.txt.value;
xlSheet.SaveAs("C:\\xlText.xls",true);
//Note that Excel has a bug and doesn't shut down after calling the
//Quit() method when automating from JScript. To work around this
//problem, the CollectGarbage() method is used to force JScript's garbage
//collection to occur almost immediately.
xlApp.Quit();
xlApp = null;
setTimeout("CollectGarbage()",0);
}
//I set the form up so the default input should be in the cell of the
//first row and second column.
< /script>
< FORM NAME="frm">
< INPUT TYPE="Text" NAME="txt" Value="Some cell text"><BR>
< INPUT TYPE="Button" VALUE="Put in row 1, column 2" ONCLICK="xlWrite
(1,2)">
< /FORM>
take note the exelfile created on "C:" of your computer with a filename of "xlText.xls" it is not possible to save this file in
serverside using javascript due to security porpuses But you can use Coldfusion <cffile> tag if you want..
Greg Griffiths <greg2@s...> wrote:If you are using client side Javascript then you won't be able to do it as
the users security model should get in the way, and if you did the file
would be created on the client PC and not on your server. You are probably
going to need to use some sort of server side code to do this.
At 19:56 20/10/02 +0000, you wrote:
>Hi,
>
>I'm relatively new to JavaScript. Here's my problem. I would like to
>create a text file dynamically that will be written to when a form
>validation is up. The file might contain a user name, age in ie. With a
>regular program, I'd would have to open a file and write to it. But I
>don't have the dimmest clue on how to do that with JavaScript. I know I
>could use Acces for this, but for learning sake, I'd like to have an idea
>on how to do this with a simple example in a text file with JavaScript.
>
>I tried by creating an array on a separate text file that I've included in
>an HTML form; but nothing happens. When I go an read the text file, no
>user names are written in the array.
>
>I don't know if there's some kind of protection mechanism that protects
>writing to files with JavaScript. The text file and the HTML file are
>stored on the server side. Does "CreateObject" has to do with that kind of
>thing?
>
>Thanks for any help.
>
>Regards
>
>Ramez
>
>---
>
>Improve your web design skills with these new books from Glasshaus.
>
>Usable Web Menus
>http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
>r-20
>Constructing Accessible Web Sites
>http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
>r-20
>Practical JavaScript for the Usable Web
>http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
>r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site