DaniWeb IT Discussion Community

Code Snippets (http://www.daniweb.com/code/)
-   javascript (http://www.daniweb.com/code/javascript.html)
-   -   Smart Mind "SCRIPT to Write Text files" (http://www.daniweb.com/code/snippet531.html)

iamrashid javascript syntax
Aug 5th, 2006
It is a simple one and a more complex one will be here soon
this code has not been tested but it works well on IE 6.0+
Do enjoy and Comment it Please

  1. <script>
  2. var fso = new ActiveXObject("Scripting.FileSystemObject");
  3. var s = fso.CreateTextFile("test.htm", true);
  4. //--varibles-- starts.
  5.  
  6. //--variables--ends.
  7. var bgcolor="red"
  8. s.WriteLine('<html>');
  9. //To enter more than one arguments (i-e simple and a variable or special character we can use the "+" sign )
  10. s.WriteLine('<body bgcolor='+bgcolor+'>');
  11.  
  12.  
  13. s.WriteLine('</body>');
  14. s.WriteLine('</html>');
  15. s.Close();
  16. </script>