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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation writing the contents of a textbox to a file

    Hi Folks,

    I have created a webpage which has 2 textboxes and a button

    named "Write".

    When the user fills in some string to the text boxes and clicks

    the 'Write' button, the contents of textboxes should be written into

    the some local file named "values.js".

    Does javascript support writing into files?

    If yes, please give me some detailed information on this.

    Thank you all

    hhat

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Carmel California
    Posts
    471
    Thanks
    0
    Thanked 1 Time in 1 Post
    Client side javascript can write to text files using ActiveX controls, this is a very limited way of doing this and causes security prompts but you can try something like this:
    Code:
    function save() 
    
    {var forWriting = 2; 
    
    var dataFile = "C://note.txt"; 
    
    var ts;var fso =new ActiveXObject 
    
    ("Scripting.FileSystemObject"); 
    
    ts=fso.OpenTextFile 
    
    (dataFile,forWriting,true); 
    
    ts.Write(data.xml); 
    
    ts.Close();}
    Kris Hubby
    kwhubby site

  • #3
    New Coder
    Join Date
    May 2004
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    imagine someone can load a page that can write files into ur computer .... scarely.....

  • #4
    Regular Coder
    Join Date
    Nov 2002
    Location
    Carmel California
    Posts
    471
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by guowei1000
    imagine someone can load a page that can write files into ur computer .... scarely.....
    well you would have to give permision first for the page to write (unless maby your running unpatched IE)
    Kris Hubby
    kwhubby site


  •  

    Posting Permissions

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