By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,688 Members | 1,911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,688 IT Pros & Developers. It's quick & easy.

Point me in the right direction

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.