471,075 Members | 1,184 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,075 software developers and data experts.

Point me in the right direction

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!
Jul 20 '05 #1
1 1417
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.'
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by John Osborne | last post: by
5 posts views Thread by AManAfterGod | last post: by
2 posts views Thread by =?Utf-8?B?cm9kY2hhcg==?= | last post: by
3 posts views Thread by pjmulla | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.