Save HTML Form data into a File using JavaScript
I'm trying to write a c开发者_开发百科ode to extract some form data from a HTML file and save them in a file using Javascript.
Example: Name, Password and email should be stored in a file (text or XML) so that i can use it later.
How can i do it? i'm new to JavaScript !!!
Thanks in advance!
Are you doing this in a browser? If so, which? None of the released (non early beta) browsers have the W3c File Writer spec implemented yet - link at http://www.w3.org/TR/file-writer-api/
Your best (only) bet is to just store the data into local storage/web storage
Ok i found what to do. in Javascript there is a class called widget in which you can store pre-defined keys such as username, password, unique key etc etc ....
Syntax:
widget.setPreferenceForKey(stringValue,stringKey);
//example
widget.setPreferenceForKey('foo','username');
you can retrieve these using the same class and assigning the value to a var,
widget.PreferenceForKey(stringKey);
//example
var user = widget.PreferenceForKey('username');
Important: you need the WRT extension installed for this to work
hope this will help .....
精彩评论