Hi,
This is what I try to do:
I have an input text box for user to type data and user can save and retrieve it. For saving the data, user has to give a filename first then click the [B]Sava Data[B]Load Data
But, currently to retrieve the data, user has to type the filename in the [B]Filename
So to list out the files that has been saved into the list box in ascending order, what should be done? Can it be done using Javascript? Hope someone could give me some idea. Thanks.
[B]Remark:
The files are saved in the Hard disk.
[B]Below is the coding:
[CODE]<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<HTML>
<HEAD>
<TITLE>Testing</TITLE>
<style type=”text/css”>
BODY {font:normal 0.8em verdana,serif;}
INPUT {font:normal 0.8em arial,helveitica;}
</style>
<STYLE>
.userData {BEHAVIOR: url(#default#userdata)}
</STYLE>
<style type=”text/css”>
.content{
height:250px;width:500px;
background:window;
color:windowtext;
padding:2px;border:2px inset threedhighlight;
overflow:auto;word-wrap:break-word;}
</style>
<script>
function fnSaveInput(){
var filename=”try_”+inputname.value+”_message”;
var oPersist=oPersistForm.oPersistText;
oPersist.setAttribute(“sPersistText”,oPersist.value);
oPersist.save(filename);
}
function fnLoadInput(){
var filename=”try_”+inputname.value+”_message”;
var oPersist=oPersistForm.oPersistText;
oPersist.load(filename);
oPersist.value=oPersist.getAttribute(“sPersistText”);
var foo = oPersist.getAttribute(“sPersistText”);
if(foo == null) oPersist.value= “”
}
</script>
</HEAD>
<body>
<table>
<form name=”oPersistForm”>
<tr align=”left” valign=”top”><td> Input text 1:
<input name=”text” type=”text” class=”userData” id=”oPersistText” size=”50″ align=”left”></form></td></tr>
<tr align=”left” valign=”top”><td>Filename:
<input type=”text” id=”inputname” size=”40″>
<input type=”button” onclick=”fnSaveInput()” value=”Save Data”>
<input type=”button” onclick=” fnLoadInput()” value=”Load Data”></td></tr>
<input type=”hidden” id=”disp_name” dataSrc=”#data” dataFld=”text”>
<div align=”center”>
<br></br>
<div align=”left” id=”EditArea” contenteditable =”true” class=”content”>
</div></div>
</table>
</body>
</html>