高分求助,一个自动定时保存表单内容到本地XML文件的例子
xry29 2004-04-16 07:07:58 <%
function ontimesave()
content=document.form1.t1.value
set xmldoc=server.createobject("msxml2.domdocument")
xmldoc.async=false
xmldoc.load("c:\save.xml")
set root=xmldoc.documentElement
'判断是否已经有了content子节点,有则修改,没有则创建
if(root.haschildnodes=false) then
conElement=xmldoc.createElement("content")
conElement.text=content
root.appendChild(conElement)
xmldoc.save("c:\save.xml")
%>
<script language="vbscript">
msgbox "save ok"
</script>
<%
else
con=xmldoc.selectSingleNode("//content")
xmldoc.text=content
xmldoc.save("c:\save.xml")
%>
<script language="vbscript">
msgbox "save ok"
</script>
<%
end if
end function
%>
<html>
<head>
<script language="JavaScript">
function s(){
setInterval("ontimesave()",1000)
}
</script>
<meta http-equiv="Content-Type" content="text/html charset=gb2312">
<title>无标题文档</title>
</head>
<body onload="s()" >
<table width="100%" height="102" border="0" align="center" cellpadding="4" cellspacing="4">
<tr>
<td height="43" align="center">定时保存页面的例子</td>
</tr>
<tr>
<td>功能:将表单中内容定时保存在本地XML文档中(C:\SAVE.XML)</td>
</tr>
<tr>
<td><form name="form1" action="">
<input name="t1" type="text" id="t1" size="30">
</form></td>
</tr>
</table>
</body>
</html>
-------------------------------------
错误:行1 缺少对象.
功能是:功能:将表单中内容定时保存在本地XML文档中(C:\SAVE.XML)