adding items to a list or menu

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • R.G. Vervoort

    adding items to a list or menu

    Not sure if it is a php question but since i am working in php here it is.

    Ho can i add items to (the item label=visual text and the value=index
    number) a list object on a website.

    I am having a list with 4 items and i would like to add the text from a
    textfield (textfield1.val ue) to the list object so it will hold 5 items.

    thanks for any suggestions

    Roy
    The Netherlands



  • Garp

    #2
    Re: adding items to a list or menu


    "R.G. Vervoort" <roy.vervoort@r oyvervoort.nl> wrote in message
    news:40719bfc$0 $563$e4fe514c@n ews.xs4all.nl.. .[color=blue]
    > Not sure if it is a php question but since i am working in php here it is.
    >
    > Ho can i add items to (the item label=visual text and the value=index
    > number) a list object on a website.
    >
    > I am having a list with 4 items and i would like to add the text from a
    > textfield (textfield1.val ue) to the list object so it will hold 5 items.
    >
    > thanks for any suggestions
    >
    > Roy
    > The Netherlands
    >
    >
    >[/color]

    You're right. That's a JavaScript question. comp.lang.javas cript is
    thataway. Sorry.

    Oh, and don't cross-post.

    Garp


    Comment

    • Chung Leong

      #3
      Re: adding items to a list or menu

      "R.G. Vervoort" <roy.vervoort@r oyvervoort.nl> wrote in message
      news:40719bfc$0 $563$e4fe514c@n ews.xs4all.nl.. .[color=blue]
      > Not sure if it is a php question but since i am working in php here it is.
      >
      > Ho can i add items to (the item label=visual text and the value=index
      > number) a list object on a website.
      >
      > I am having a list with 4 items and i would like to add the text from a
      > textfield (textfield1.val ue) to the list object so it will hold 5 items.
      >
      > thanks for any suggestions[/color]

      Just to piss off the other guy, here's the JS code for adding an item

      var o = document.create Element('OPTION ');
      o.innerText = textfield1.valu e;
      o.value = 'Something';
      document.getEle mentById('listb ox_id').appendC hild(o);

      HTML:

      <select id="listbox_id" >
      <option>Hello </option>
      ...
      </select>



      Comment

      • Robert

        #4
        Re: adding items to a list or menu

        "R.G. Vervoort" <roy.vervoort@r oyvervoort.nl> wrote in message news:<40719bfc$ 0$563$e4fe514c@ news.xs4all.nl> ...[color=blue]
        > Not sure if it is a php question but since i am working in php here it is.
        >
        > Ho can i add items to (the item label=visual text and the value=index
        > number) a list object on a website.
        >
        > I am having a list with 4 items and i would like to add the text from a
        > textfield (textfield1.val ue) to the list object so it will hold 5 items.
        >
        > thanks for any suggestions
        >
        > Roy
        > The Netherlands[/color]

        PHP is server side, it looks like you want to send items to a client
        side app (javascript?) you could do something like this:

        --->Snip!

        <?php

        $array = array('item1', 'item2', 'item3', 'item4'); //I use an array
        here for simplicity, you could do the same with a dB query or the like

        echo "<html>\n<head> </head><!--javascript-->"; //Not a javascript guy,
        but you get the point

        foreach($array as $key=>$item) {
        echo "\n textdata.item$k ey=$item";
        }

        ?>
        <body> etc.....

        <---

        Not sure how javascript looks (started working with it in last 2 days)
        but you can change that echo statement to what it should be in
        javascript

        Cheers!

        Robert

        Comment

        • Garp

          #5
          Re: adding items to a list or menu


          "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
          news:1LidnZHUOo IJv-_dRVn-jg@comcast.com. ..[color=blue]
          > "R.G. Vervoort" <roy.vervoort@r oyvervoort.nl> wrote in message
          > news:40719bfc$0 $563$e4fe514c@n ews.xs4all.nl.. .[color=green]
          > > Not sure if it is a php question but since i am working in php here it[/color][/color]
          is.[color=blue][color=green]
          > >
          > > Ho can i add items to (the item label=visual text and the value=index
          > > number) a list object on a website.
          > >
          > > I am having a list with 4 items and i would like to add the text from a
          > > textfield (textfield1.val ue) to the list object so it will hold 5 items.
          > >
          > > thanks for any suggestions[/color]
          >
          > Just to piss off the other guy, here's the JS code for adding an item
          >
          > var o = document.create Element('OPTION ');
          > o.innerText = textfield1.valu e;
          > o.value = 'Something';
          > document.getEle mentById('listb ox_id').appendC hild(o);
          >
          > HTML:
          >
          > <select id="listbox_id" >
          > <option>Hello </option>
          > ...
          > </select>[/color]

          Heh, if you mean me as "the other guy", I'm happy he got his answer. And
          when he asks which lace to cross next in four groups, you can help there too
          (and repeat his cross-post again).

          Hugs.

          Garp


          Comment

          • Chung Leong

            #6
            Re: adding items to a list or menu

            "Garp" <garp7@no7.blue yonder.co.uk> wrote in message
            news:%jscc.3799 $Jk5.37077192@n ews-text.cableinet. net...[color=blue]
            > Heh, if you mean me as "the other guy", I'm happy he got his answer. And
            > when he asks which lace to cross next in four groups, you can help there[/color]
            too[color=blue]
            > (and repeat his cross-post again).[/color]

            Oops. Didn't even check the to line.


            Comment

            Working...