Point me in the right direction

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • A. Name

    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!
  • Lasse Reichstein Nielsen

    #2
    Re: Point me in the right direction

    orakin@hotmail. com (A. Name) writes:
    [color=blue]
    > 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:[/color]

    How is it displayed? As an <ul>-list or as a <select>-element?
    The latter is much easier to change.
    [color=blue]
    > -----------------
    > | tweeking | Add
    > -----------------
    >
    > Current List
    > one
    > three
    >
    > After Add
    > one
    > three
    > tweeking[/color]

    Must the entries be alphabetic, or is that a coincidence?
    [color=blue]
    > I was thinking array, I think I will have to add it to an array and
    > then rewrite the array to the page.[/color]

    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.f orm.elements['list'].add(
    new Option(this.for m.elements['input'].value),undefin ed);">
    <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.create Element('li');
    li.appendChild( document.create TextNode(
    this.form.eleme nts['input'].value));
    document.getEle mentById('list' ).appendChild(l i);">
    </form>
    <ul id="list">
    </ul>
    ---

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...