Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript
hi friends i am new to this blog, I am going to creating application like text editor using javascript, I am trying to create a new text file using ActiveXObject window method by clicking the button. Its creating a file but i want to create a new textfile when i clicked the button..
here the code which i used for creating file..
function createfile()
{
var file;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("C:\Libraries\Documents\NewFile.txt", 8, true, 0);
s.WriteLine(......);
s.Close();
}
please help me...
Posted 28-Mar-13 12:30pm
Comments
richcb at 28-Mar-13 17:32pm
   
I don't think Java Script has a WriteLine() method, it is just .Write.
ThePhantomUpvoter at 28-Mar-13 17:42pm
   
If it is creating a file, which is what you want to do, then what is the problem?
Sergey Alexandrovich Kryukov at 28-Mar-13 17:44pm
   
Do you think using ActiveX in HTML's JavaScript is at all acceptable? :-)
—SA
Member 9950476 at 29-Mar-13 14:47pm
   
i want to create multiple text files..

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

First of all, it's a really bad thing to use ActiveX object in JavaScript, virtually in all cases. This won't ever be supported by all browsers and platforms, and, more importantly, is utterly unsafe. If any experienced user will see that you are doing such things, such person will never use your products or products of your company, as it would suggest that such company does not consider very basic security practices.
 
And you really never need it for your purpose. As to the creation of the text editors, they can be pure JavaScrip tools working on all platforms. For example, look at this HTML (not just text) WYSIWYG editor:
http://en.wikipedia.org/wiki/TinyMCE[^],
http://www.tinymce.com/[^].
 
You can look at the source code and get the basic ideas.
 
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 190
1 Jochen Arndt 165
2 PIEBALDconsult 150
3 BillWoodruff 148
4 DamithSL 140
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100