Point me in the right direction

A

A. Name

Can someone please point me in the right direction?

This is what I want to accomplish.

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:

-----------------
| tweeking | Add
-----------------

Current List
one
three

After Add
one
three
tweeking

I was thinking array, I think I will have to add it to an array and
then rewrite the array to the page.

Thanks!
 
L

Lasse Reichstein Nielsen

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:

-----------------
| 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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top