Results 1 to 3 of 3

Thread: Add option value for List/Menu box

  1. #1
    Join Date
    Jul 2002
    Posts
    9
    Rep Power
    0

    Lightbulb Add option value for List/Menu box

    Hi, need some help pls

    I have 1 List/Menu box(myList) 1 button (AddList) and 1 button (Remove) . My button will enable the user to add/remove the list from list/menu box. The 'Remove' button is ok but i can't figure out how to make the 'AddList' button working..

    My Code:
    --the function
    PHP Code:
    <script language=javascript>
    function 
    AddNewList()
    {
    strValue="data1"
    strList="<option>" strValue "</option>";
    }
    </script> 
    --the form
    PHP Code:
    <select id=myList name=myList form=theform size=>
             <
    script language=vbscript>
             
    AddNewList()
             
    document.write strList 
             </script>
    </select>
    <input type=button name=Remove value="Remove"
    onclick="javascript:theform.myList.remove(theform.myList.selectedindex);">

    <input type=button name=AddList value="AddList" onclick="AddNewList()"> 
    any Hint???
    thanks in advanced.
    Last edited by kala_krayon; 22-08-2002 at 01:21 PM.

  2. #2
    Join Date
    Jul 2001
    Location
    KL, Malaysia
    Posts
    277
    Rep Power
    228
    Are you looking for something like this?

    PHP Code:
    <html>
    <
    script language=javascript>
        function 
    add() {
            
    frm.s.add(new Option(frm.new_value.valuefrm.new_value.value));
        }
        
        function 
    remove() {
            
    frm.s.remove(frm.s.selectedIndex);
        }
    </script>

        <br><br>

        <form name=frm>
            <select name=s>
            <option>Please select...</option>
            </select>

            <br><br>
            <input type=button value=" Add " onclick="add();"> New Option Value <input type=text name=new_value><br>
            <input type=button value=" Remove " onclick="remove();">
        </form>
    </html> 

  3. #3
    Join Date
    Jul 2002
    Posts
    9
    Rep Power
    0

    TQ

    yaa sort of... anyway thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. The best option for utilization of leisure time
    By kman123 in forum Mamak Stall
    Replies: 2
    Last Post: 21-07-2011, 01:04 AM
  2. Language option?
    By reez0105 in forum FeedBack & Suggestion
    Replies: 1
    Last Post: 10-12-2009, 10:16 PM
  3. Webhosting with ()fsockopen option available
    By mfashraf in forum Paid Hosting Discussion Forum
    Replies: 4
    Last Post: 19-02-2008, 11:53 PM
  4. Bot/Spider List/Spam Bot List
    By genzy in forum Website Programming
    Replies: 0
    Last Post: 01-07-2007, 10:29 AM
  5. list down menu...
    By prinses in forum Website Programming
    Replies: 8
    Last Post: 10-09-2004, 07:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32