Can Somebody help me......

javascript India
  • 13 years ago

    Hai guys

     

    I want the javascript code to write the content of a textarea to a file, the file should be choosen using filedailogBox.

  • 13 years ago
    try this function

    function WriteToFile() {
         var filename = 'c://test.txt';
         var fso = new ActiveXObject('Scripting.FileSystemObjec
    t');
         if (fso.FileExists(filename)) {
              var a, ForAppending, file;
              ForAppending = 8;
              file = fso.OpenTextFile(filename, ForAppending, false);
              file.WriteLine("welcome");
              }
         else {
              var file = fso.CreateTextFile(filename, true);
              file.WriteLine("welcome");
              }
         file.Close();
         }

















  • 13 years ago

    Thanks for your reply.

    It is working,but the problem is :

    I have to use 

    "document.execCommand('SaveAs',true,'c:\\file.txt');"

    So how to get the file path into a var.

  • 13 years ago
    sankar_mdu2 wrote:
    try this function

    function WriteToFile() {
         var filename = 'c://test.txt';
         var fso = new ActiveXObject('Scripting.FileSystemObjec
    t');
         if (fso.FileExists(filename)) {
              var a, ForAppending, file;
              ForAppending = 8;
              file = fso.OpenTextFile(filename, ForAppending, false);
              file.WriteLine("welcome");
              }
         else {
              var file = fso.CreateTextFile(filename, true);
              file.WriteLine("welcome");
              }
         file.Close();
         }

















     

    Thanks for your reply.

    It is working,but the problem is :

    I have to use 

    "document.execCommand('SaveAs',true,'c:\\file.txt');"

    So how to get the file path into a var.

     

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Weeks of coding can save you hours of planning.”