/    Sign up×
Community /Pin to ProfileBookmark

How to list out in a list box?

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] button. The filename will then be listed out into the list box in ascending order. To retrieve the data again, user has to select the filename from the list first then click the [B]Load Data[/B] button. The data will then be listed back into the input text box.

But, currently to retrieve the data, user has to type the filename in the [B]Filename[/B] input textbox.

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:[/B]
The files are saved in the Hard disk.

[B]Below is the coding:[/B]

[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>
[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @apple_wp spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...