如何将text1值( javascript 值)分配给 vbscript 变量,以便我可以将该数据写入
使用ts.WriteLine(av)
我尝试提交表单并在下一个.asp页面中获取所有值,然后将其写入文本文件, 但我的价值有很多字母数字和特殊字符....所以我不能以这种方式实现......请帮忙。
<% Option Explicit
Const Filename = "/project.txt" ' file to read
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim FSO
set FSO = server.createObject("Scripting.FileSystemObject")
Dim Filepath
Filepath = "E:\applications\FTP\project.txt"
if FSO.FileExists(Filepath) Then
Dim file
set file = FSO.GetFile(Filepath)
Dim TextStream
Set TextStream = file.OpenAsTextStream(ForReading, TristateUseDefault)
%>
<form id="ValidForm" action="">
<input type="textbox" name="ac" id="ac" value="">
<textarea rows="100" cols="230" contenteditable>
<% Do While Not TextStream.AtEndOfStream
Dim Line
Line = TextStream.readline
Line = Line & vbCRLF
Response.write Line
Loop
%>
</textarea>
</form >
<%
Response.Write "</pre><hr>"
Set TextStream = nothing
End If
Set FSO = nothing
%>
<button onclick=abc();>save</button>
<script type="text/javascript" >
function abc()
{alert("1");
var contenteditable = document.querySelector('[contenteditable]'),
text1 = contenteditable.textContent;
//document.getElementById("ac").value=text1;
alert(text1);
}
</script>
<%
'what i should add here to get the javascript variable(text1)
set fs=Server.CreateObject("Scripting.FileSystemObject")
set ts = fs.CreateTextFile("E:\\applications\\FTP\\shivan123.txt",true)
ts.WriteLine("This is my first FileSystemObject application.")
ts.WriteLine( )
ts.Close()
set ts=nothing
set fs=nothing
%>