![asp.net如何读写js文件,第1张 asp.net如何读写js文件,第1张](/aiimages/asp.net%E5%A6%82%E4%BD%95%E8%AF%BB%E5%86%99js%E6%96%87%E4%BB%B6.png)
只有把js文件路径导入就可以了,例子: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns=" http://www.w3.org/1999/xhtml"><head runat="server"><script language="javascript" type="text/javascript" src="js/test.js"></script><title>无标题页</title></head><body><form id="form1" runat="server"><div>dfg df gdf gg </div></form></body></html>
求采纳
在浏览器中做不到,使用javascript服务器端运行环境可以做到,比如可以使用node.js来做。
如:
fs.writeFile('xxx.txt', 'Hello Node', function (err) {
if (err) throw err
console.log('It\'s saved!')
})
fs.readFile('xxx.txt', function (err, data) {
if (err) throw err
console.log(data)
})