or****@hotmail.com (A. Name) writes:
The page has a simple form for input on it. When a user enters in
information and clicks the button, the current list of items is
displayed. So, if the page looks like this:
How is it displayed? As an <ul>-list or as a <select>-element?
The latter is much easier to change.
-----------------
| tweeking | Add
-----------------
Current List
one
three
After Add
one
three
tweeking
Must the entries be alphabetic, or is that a coincidence?
I was thinking array, I think I will have to add it to an array and
then rewrite the array to the page.
If you can't remove elements from the list, then you don't need to
remember the elements. You can just add new elements after the ones
already there.
Sample code:
--- select element ---
<form action="...">
<input type="text" name="input">
<input type="button" value="Add"
onclick="this.form.elements['list'].add(
new Option(this.form.elements['input'].value),undefined);">
<br>
<select name="list" size="10">
</form>
---
or:
--- ul element ----
<form action="...">
<input type="text" name="input">
<input type="button" value="Add"
onclick="var li = document.createElement('li');
li.appendChild(document.createTextNode(
this.form.elements['input'].value));
document.getElementById('list').appendChild(li);">
</form>
<ul id="list">
</ul>
---
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'