[英]Save HTML Form data into a File using JavaScript
I'm trying to write a code to extract some form data from a HTML file and save them in a file using Javascript. 我正在尝试编写代码以从HTML文件中提取一些表单数据,然后使用Javascript将其保存在文件中。
Example: Name, Password and email should be stored in a file (text or XML) so that i can use it later. 示例:名称,密码和电子邮件应存储在文件(文本或XML)中,以便以后使用。
How can i do it? 我该怎么做? i'm new to JavaScript !!!
我是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/
尚未发布的(非早期Beta版)浏览器尚未实现W3c File Writer规范-链接位于http://www.w3.org/TR/file-writer-api/
Your best (only) bet is to just store the data into local storage/web storage 最好(唯一)的选择是将数据存储到本地存储/ Web存储中
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 ....
在Javascript中,有一个称为小部件的类,您可以在其中存储预定义的键,例如用户名,密码,唯一键等。
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, 您可以使用相同的类来检索这些值,并将其值分配给var,
widget.PreferenceForKey(stringKey);
//example
var user = widget.PreferenceForKey('username');
Important: you need the WRT extension installed for this to work 重要提示:您需要安装WRT扩展程序才能正常工作
hope this will help ..... 希望这会帮助.....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.