简体   繁体   English

如何使用javascript将文本框数据保存到文件

[英]How to save textbox data to file using javascript

I have a web page containing a textbox. 我有一个包含文本框的网页。 This textbox shows result of processing. 此文本框显示处理结果。 There is a button "Save Result" to save contents of textbox to file. 有一个“保存结果”按钮,用于将文本框的内容保存到文件中。 I know it can be easily done with FileStream. 我知道可以使用FileStream轻松完成。 But I want the same functionality to save file using Javascript so that there is no need for server postback. 但是我希望使用相同的功能来使用Javascript保存文件,这样就不需要服务器回发了。

Do anybody have solution to this? 有人有解决方案吗?

Thanks for sharing your time. 谢谢你分享你的时间。

As Darin said JavaScript works on the client's side. 正如Darin所说,JavaScript在客户端工作。 As far as I know you won't be able to create files on the user computer using javascript. 据我所知,您将无法使用javascript在用户计算机上创建文件。

A little google-ing mentioned it being posible with JScript/ActiveX/IE (Never tried it).But I would suggest a different approach. 有点google-ing提到它可以用JScript / ActiveX / IE(从未尝试过)。但我建议采用不同的方法。 Good luck! 祝好运!

您可以使用html5的本地存储将其保存到客户端的文件系统,但只能访问该网站。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM