473,797 Members | 3,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a txt file with javascript

Fuhrer
30 New Member
Hi there,
i'm trying to create a javascript function that would create a text file so i can write some informations in it and read it later.
I'm using the "ActiveXObject( "Scripting.File SystemObject")" ,

function makefile(){
var fso;var thefile;

fso = new ActiveXObject(" Scripting.FileS ystemObject");
thefile=fso.Cre ateTextFile("c: \\test.txt",tru e);

fso.close()
}

but nothing is happening,

so please help me,
Thank u
Dec 30 '06 #1
12 22041
johnhjohn
43 New Member
I am not familiar with Active X, but when I tried your code on my computer, the error said that the object doesn't support that method ( fso.close() ). The code worked fine without the fso.close() and successfully created a file named test.txt.


Hope I helped :).
Jan 1 '07 #2
johnhjohn
43 New Member
Use thefile.close() instead of fso.close().
Jan 1 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Hi there,
i'm trying to create a javascript function that would create a text file so i can write some informations in it and read it later.
I'm using the "ActiveXObject( "Scripting.File SystemObject")" ,

function makefile(){
var fso;var thefile;

fso = new ActiveXObject(" Scripting.FileS ystemObject");
thefile=fso.Cre ateTextFile("c: \\test.txt",tru e);

fso.close()
}

but nothing is happening,

so please help me,
Thank u
This will probably only be supported on IE browsers. Also, allowing a web page to create files is a security hole. If you need to just remember values why not use cookies instead?
Jan 1 '07 #4
Fuhrer
30 New Member
This will probably only be supported on IE browsers. Also, allowing a web page to create files is a security hole. If you need to just remember values why not use cookies instead?



Thanks for ur advice, but im trying to make a login page that allow to save username and password, just like the " Hotmail " page where a user has 3 option to log in:
1-Save my username and password on this computer
2-Save my username on this computer
3-Always ask for my username and password

If u have an idea to help me with such page ,i will appreciate that,

Thank u
Jan 2 '07 #5
b1randon
171 Recognized Expert New Member
Thanks for ur advice, but im trying to make a login page that allow to save username and password, just like the " Hotmail " page where a user has 3 option to log in:
1-Save my username and password on this computer
2-Save my username on this computer
3-Always ask for my username and password

If u have an idea to help me with such page ,i will appreciate that,

Thank u
You should look up the use of cookies. They are designed to do exactly what you're talking about without having to be IE only and without the security crappiness.
Jan 2 '07 #6
bikash123
4 New Member
I am trying create a ActiveXObject like myActiveXObject = new ActiveXObject(" Scripting.FileS ystemObject")

in asp.net 2.0 with IE7.0
but getting error like Automation server cannot create object !!!!

what's the actual problem?
Is it necessary to install any component?
I haven't install anything..

Can anybody help me?

Thank you.
Bikash
Feb 22 '07 #7
acoder
16,027 Recognized Expert Moderator MVP
I am trying create a ActiveXObject like myActiveXObject = new ActiveXObject(" Scripting.FileS ystemObject")

in asp.net 2.0 with IE7.0
but getting error like Automation server cannot create object !!!!

what's the actual problem?
Is it necessary to install any component?
I haven't install anything..

Can anybody help me?

Thank you.
Bikash
See this Microsoft KB article.
Feb 22 '07 #8
bikash123
4 New Member
I am getting some error like unboxed type error when I am converting nullable Int64 variable when I am getting a null from database,it is ok when it is returning some value .
Look at the following code :--------------

Int64? Approval_Dateti me = (DR["Approval_Datet ime"] == DBNull.Value) ? null : (DateTime?)DR["Approval_Datet ime"]; //It is O.K.

Int64? Approved_By_Adm in_Id = (DR["Approved_By_Ad min_Id"] == DBNull.Value) ? null : (Int64)(DR["Approved_By_Ad min_Id"]); //here I am getting error like unboxed type when I am getting null value from database

How will I be able to overcome this ..
Can anybody help me?
Feb 23 '07 #9
bikash123
4 New Member
See this Microsoft KB article.
Thanks to acoder.
Feb 23 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3447
by: Bnob | last post by:
It is possible to create a file in local user-machine? With this code in code-behind: fs = New System.IO.FileStream(lFileCSV, System.IO.FileMode.Create, System.IO.FileAccess.Write) The file is created on the server. Any idea?
1
2211
by: Victor | last post by:
Hi, We have following setup here Web Server (Win2000) and FTP Server (Win 2000) We have ASP.NET application which runs on Web Server and writes file(s) onto FTP Server. We created asp.net network account and made sure that ASP.NET application runs under this account. Also, we gave full rights (with asp.net network account ) to FTP Server directory. When I try to create file on FTP Server from ASP.NET application, I get following message:...
11
2376
by: TJM | last post by:
Hi, A Javascript error is generated when the user types a few character in an INPUT TYPE=FILE and hits a submit button. The form does not post. Is there a solution to this problem? Thanks TJM
1
2123
by: j7o0s5 | last post by:
How to create file help chm?
2
1856
by: SteMc | last post by:
Hi, I'm trying to create a text file on an asp page but am having loads of trouble. At the minute what happens is this - I have a form with a textarea. When the form posts, the action is to run an asp page. Inside the asp page I want to take the text from the textarea and write it to a text file. the following way to do this;
1
1580
by: philmaz | last post by:
What I am trying to do is create a form that people can use to enter their email address to sign up for a mailing list. Once they enter their email address, I want the script to open up a txt file that is stored on the server and write the email adress to the bottom of the txt file. Then close and save the file. Is this at all possible to do with client side script on any kind? go to http://www.thetimelineband.com/emailform.html to...
1
1470
by: colleen1980 | last post by:
Hi: Can any one please tell me how to i create a button which open a file window from where i select any file and then it pass the file data into the list box. Basically in this file i have only 6 digit numbers which i need to process into the listbox. Needs help Thanks, Anna.
0
1411
Kosal
by: Kosal | last post by:
Hi I have problem with vb.net I want to create file setup or exe file for run on Client Computer that no need to install vb.net 2005 but I never do so I don't know what can i do? Please help Thanks
5
3682
by: plsHelpMe | last post by:
How to create dynamic javascript arrays using dojo toolkits Hello frens, I am in a big trouble. My objective is: I am having some categories shown by differnent radio buttons, on the click of a particular radio button i making an ajax call using dojo and retirieving the data corresponding to that category. Now i am suppose to create array of that data using the javascript dynamically. Can anyone please help me for the same. For your...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10245
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.