alcool9999
Technical User
Hi i have a script that has a text area with a form in it.
when the user clicks submit it saves the data to an xml file so i can see the data.
when you do it again it overites the data.
is there anyway i can stop this.
code:
<HTA:APPLICATION ID="oWriteXML"
APPLICATIONNAME="Save Text to XML"
VERSION="1.0"
CAPTION="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="maximize">
<title>Write text and save to XML document</title>
<script language="JScript">
<!--
function saveXML(saveWhat, saveWhere)
{
document.getElementById('gen').innerHTML='Generating File...';
var fileSys = new ActiveXObject("Scripting.FileSystemObject");
var xmlFile=fileSys.CreateTextFile(saveWhere);
var allXML='';
allXML+=document.getElementById('formatPart1').innerHTML;
allXML+=saveWhat.value;
allXML+=document.getElementById('formatPart2').innerHTML;
xmlFile.write(allXML);
xmlFile.close();
document.getElementById('gen').innerHTML='Done. You may now close this window or view what you submitted.';
}
//-->
</script>
</head>
<body>
<!-- This is how the text will be formatted in the XML file. Part 1 is what will
be generated before the text, while part 2 will be generated after the text.
The XMP tag does not eliminate whitespace like other tags do. -->
<xmp id="formatPart1" style="display:none;">
<?xml version="1.0"?>
<note>
<text>
</xmp>
<xmp id="formatPart2" style="display:none;">
</text>
</note>
</xmp>
<textarea name="text" id="text" rows="5" cols="40">
Name:
Email:
Favourite Animal:
Favourite Sport:
</textarea><br />
<input type="button" value="Submit" onclick="saveXML(document.getElementById('text'), 'text.hta');" /><br />
<span id="gen"></span>
Thankyou
when the user clicks submit it saves the data to an xml file so i can see the data.
when you do it again it overites the data.
is there anyway i can stop this.
code:
<HTA:APPLICATION ID="oWriteXML"
APPLICATIONNAME="Save Text to XML"
VERSION="1.0"
CAPTION="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="maximize">
<title>Write text and save to XML document</title>
<script language="JScript">
<!--
function saveXML(saveWhat, saveWhere)
{
document.getElementById('gen').innerHTML='Generating File...';
var fileSys = new ActiveXObject("Scripting.FileSystemObject");
var xmlFile=fileSys.CreateTextFile(saveWhere);
var allXML='';
allXML+=document.getElementById('formatPart1').innerHTML;
allXML+=saveWhat.value;
allXML+=document.getElementById('formatPart2').innerHTML;
xmlFile.write(allXML);
xmlFile.close();
document.getElementById('gen').innerHTML='Done. You may now close this window or view what you submitted.';
}
//-->
</script>
</head>
<body>
<!-- This is how the text will be formatted in the XML file. Part 1 is what will
be generated before the text, while part 2 will be generated after the text.
The XMP tag does not eliminate whitespace like other tags do. -->
<xmp id="formatPart1" style="display:none;">
<?xml version="1.0"?>
<note>
<text>
</xmp>
<xmp id="formatPart2" style="display:none;">
</text>
</note>
</xmp>
<textarea name="text" id="text" rows="5" cols="40">
Name:
Email:
Favourite Animal:
Favourite Sport:
</textarea><br />
<input type="button" value="Submit" onclick="saveXML(document.getElementById('text'), 'text.hta');" /><br />
<span id="gen"></span>
Thankyou