asp将表单保存到txt源码
1个回答
展开全部
<%
Dim sName
sName = MyData("MyContent.txt")
Function MyData(MyFile)
Dim objFSO,objTS, sName, b, sLine
sName = Request("nam1")
b = False
Application.Lock
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTS = objFSO.OpenTextFile(Server.MapPath(MyFile),1,True)
Do While Not objTS.AtEndOfStream
sLine = objTS.ReadLine()
If sLine = sName Then
b = True
Exit Do
End If
Loop
objTS.Close
If b Then
MyData = ""
Else
Set objTS=objFSO.OpenTextFile(Server.MapPath(MyFile),8,True)
objTS.WriteLine(sName)
objTS.Close
MyData= sName
End If
Application.Unlock
End Function
%>
<html>
<body>
<title>数据写入</title>
<script language="JavaScript">
document.oncontextmenu=new Function("event.returnValue=false;");
document.onselectstart=new Function("event.returnValue=false;");
</script>
<body bgcolor="#640702">
<table border="0" width="100%" cellpadding="0" style="border-collapse: collapse">
<tr>
<td align="center">
<table border="0" width="598" cellpadding="0" style="border-collapse: collapse" height="500">
<tr>
<td align="center">
<table border="0" cellpadding="0" style="border-collapse: collapse" width="598" height="500">
<tr>
<td align="center" height="26">
<img border="0" src="images/top.jpg" width="598" height="26"></td>
</tr>
<tr>
<td align="center" background="images/ct_bg.jpg" valign="bottom" height="200">
<img border="0" src="images/logo.jpg"><br>
<br>
<br>
</td>
</tr>
<tr>
<td align="center" background="images/ct_bg.jpg" height="260" valign="top">
<%If sName <> "" Then%>
<b><font color="#FF00FF" size="4">验证通过!</font><font size="4">您的
姓名为:<%=sName%></font></b><br>
<%Else%>
<b><font color="#FF00FF" size="4">请不要重复输入。</font></b><br>
<%End If%>
<br>
<b><font size="4" color="#FF0000">如果未验证成功,请检查姓名是否正确!</font></b><br>
<br>
<a href="javascript:window.close()" style="text-decoration: none; font-weight:700">
<font size="5">返回</font></a> </td>
</tr>
<tr>
<td height="26" align="center">
<img border="0" src="images/end.jpg" width="598" height="26"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询