Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    glz
    glz is offline
    New Coder
    Join Date
    Apr 2007
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question writing to a text file with javascript

    Hello I'm having trouble writing to a text file with javascript, i've tried writing to a local text file on my own PC, and I've also tried writing to a local file on my own server, (which I have all permissions to do so...)

    I'd really like to write to a file that resides on my own web server.
    Here is my code:

    Code:
    <head>
    <SCRIPT LANGUAGE="JavaScript">
     function WriteToFile() {
        
        set fso = CreateObject("Scripting.FileSystemObject");  
        set s = fso.CreateTextFile("C:\test.txt", True);
        s.writeline("HI");
        s.writeline("Bye");
        s.writeline("-----------------------------");
        s.Close();
     }
      </SCRIPT>
    </head>
    <body>
    <form onSubmit="WriteToFile()">
    <input type="submit" value="Run the WriteToFile Function!">
    </form> 
    </body>

    quite frankly it just doesn't work, you know what I want to do, I gave you my attempt, please help me do it

    thank you

  • #2
    Regular Coder
    Join Date
    May 2007
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why don't use rather some server side script language? Javascript is the client side script so don't try to perform some actions on the server side, ASP and PHP are the server side scripting languages and that's the right choice.
    Forum for webmasters and developers
    http://www.htmlfrenzy.com
    Are you an IT expert? Join our Reward system
    www.htmlfrenzy.com/reward-system.php


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •