Javascript编写文件

Javascript编写文件,javascript,saving-data,local-files,Javascript,Saving Data,Local Files,我正试图将其写入服务器上的本地文件,但遇到了一些问题。我让它写一个文件,然后在浏览器中阅读,但我不能把一个链接到它,以便其他人可以运行弹出横幅,而不输入信息。下面是我正在使用的javascript。我知道使用字幕不是最好的,但这是必须的。此外,这只需要在本地网络上工作,而不需要面向internet。这将在服务器上运行,服务器上的文件链接是提供给其他每个人的。更重要的是,页面将从同一文件夹运行。很抱歉。谢谢你的帮助 我在这里找到了我的问题的答案 -----------Test.js文件------

我正试图将其写入服务器上的本地文件,但遇到了一些问题。我让它写一个文件,然后在浏览器中阅读,但我不能把一个链接到它,以便其他人可以运行弹出横幅,而不输入信息。下面是我正在使用的javascript。我知道使用字幕不是最好的,但这是必须的。此外,这只需要在本地网络上工作,而不需要面向internet。这将在服务器上运行,服务器上的文件链接是提供给其他每个人的。更重要的是,页面将从同一文件夹运行。很抱歉。谢谢你的帮助

我在这里找到了我的问题的答案

-----------Test.js文件-----------
函数openWin(){
var myWindow=window.open(“,”MsgWindow“,”宽度=2000,高度=200,位置=no,notoolbar=no,菜单栏=no,滚动条=yes,左侧=0,顶部=950”);
var text=document.getElementById('notebox');
var image1=document.getElementById('image1');
var image2=document.getElementById('image2');
var imlink=document.getElementById('imlink');
var background=document.getElementById('background');
var fontsize=document.getElementById('fontsize');
var fontcolor=document.getElementById('fontcolor');
var fonttype=document.getElementById('fonttype');
var fontspeed=document.getElementById('fontspeed');
myWindow.document.write(“+text.value+”);
myWindow.document.close()
}
函数SaveDatFileBro(本地存储){
localstorage.root.getFile(“Banner.html”,{create:true});
}
--------------------------------Banner.html---------------------------------
字体颜色:字体类型:字体大小:滚动速度:
背景颜色:前导图像:尾随图像:

这是不可能的。您的浏览器绝对无法访问服务器上的文件系统


如果要写入服务器的文件系统,则需要一个服务器端进程,用于侦听通过HTTP从浏览器提交给它的数据。

如果要在服务器上存储数据,您需要在服务器上运行代码来保存该文件。它将在服务器上运行,但目前我无法在运行该文件时将其保存到本地计算机。
                ---------------Test.js file-----------
function openWin() {
var myWindow = window.open("", "MsgWindow", "width=2000,height=200,location=no,notoolbar=no,menubar=no,scrollbars=yes,left=0,top=950");
var text = document.getElementById('notebox');
var image1 = document.getElementById('image1');
var image2 = document.getElementById('image2');
var imlink = document.getElementById('imlink');
var background = document.getElementById('background');
var fontsize = document.getElementById('fontsize');
var fontcolor = document.getElementById('fontcolor');
var fonttype = document.getElementById('fonttype');
var fontspeed = document.getElementById('fontspeed');
    myWindow.document.write("<marquee behavior='scroll' direction='left' scrollamount='"  + fontspeed.value +  "' BGCOLOR='"  + background.value +  "'><h1 style='font-size:"  + fontsize.value +  "px;color:"  + fontcolor.value +  ";font-family:" + fonttype.value + ";'><img src='"  + image1.value +  "' style='width:100px;height:100px;' > "  + text.value +  " <img src='"  + image2.value +  "' style='width:100px;height:100px;' ></h1></marquee>"); 
   myWindow.document.close()
}
function SaveDatFileBro(localstorage) {
   localstorage.root.getFile("Banner.html", {create: true});
}


--------------------------------Banner.html---------------------------------
<!DOCTYPE html>
<html>
<head>
<title>
</title>
</head>
<body>

<script src="Test.js"></script>

<table style="margin:0px auto 0px auto"> 
    <tr>
        <td><input type="button" value=" Open Banner" onclick="openWin();SaveDatFileBro()"/></td>
    <td><input type="text" id="notebox" value="Enter Notification" size="120"/></td>
    </tr>
    <tr>
        <td><input type="button" value=" Save Banner" onclick="SaveDatFileBro()"/></td>
        <td>Font Color:<input type="text" id="fontcolor" value="Red"/> Font Type:<input type="text" id="fonttype" value="Times New Roman"/> Font Size:<input type="text" id="fontsize" value="130" /> Scroll Speed:<input type="text" id="fontspeed" value="25" /></td>
    </tr>
        <tr>
        <td></td>
        <td>Background Color:<input type="text" id="background" value="White" />  Leading Image:<input type="text" id="image1" value="https://vignette2.wikia.nocookie.net/uncyclopedia/images/4/44/White_square.png/revision/latest/scale-to-width-down/200?cb=20061003200043" /> Trailing Image:<input type="text" id="image2" value="https://vignette2.wikia.nocookie.net/uncyclopedia/images/4/44/White_square.png/revision/latest/scale-to-width-down/200?cb=20061003200043" /></td>
    </tr>
</table>


</body>
</html>