Dynamic HTML-Menu

Discussion in 'Javascript' started by Konrad Mathieu, Jul 6, 2003.

  1. Dynamically changing an HTML-menu:

    function changeSelectMenu(v){
    for(i=0;i<v;i++){
    NewEntry = new Option(i+1,i,false,false);
    document.Testform.Testmenu.options = NewEntry;
    }
    }

    ....works fine but:
    When "v" is changed to a lower value, the old higher entries are still
    visible.

    How can one clear the options object before rewriting it?

    Thanx and cheers,
    Konrad
    Konrad Mathieu, Jul 6, 2003
    #1
    1. Advertising

  2. "Janwillem Borleffs" <> schreef in bericht
    news:3f08372b$0$28890$...
    >
    > function changeSelectMenu(v){
    > document.Testform.Testmenu.length=0;
    > for(i=0;i<v;i++){
    > NewEntry = new Option(i+1,i,false,false);
    > document.Testform.Testmenu.options = NewEntry;
    > }
    >


    Sorry, missed out on the closing brace to end the for-loop:

    function changeSelectMenu(v){
    document.Testform.Testmenu.length=0;
    for(i=0;i<v;i++){
    NewEntry = new Option(i+1,i,false,false);
    document.Testform.Testmenu.options = NewEntry;
    }
    }


    JW
    Janwillem Borleffs, Jul 6, 2003
    #2
    1. Advertising

  3. Re: Dynamic HTML-Menu-> Great one, thanks!

    Great one! Thanks!
    Cheers,
    Konrad



    "Janwillem Borleffs" <> schrieb im Newsbeitrag
    news:3f08389f$0$28902$...
    >
    > "Janwillem Borleffs" <> schreef in bericht
    > news:3f08372b$0$28890$...
    > >
    > > function changeSelectMenu(v){
    > > document.Testform.Testmenu.length=0;
    > > for(i=0;i<v;i++){
    > > NewEntry = new Option(i+1,i,false,false);
    > > document.Testform.Testmenu.options = NewEntry;
    > > }
    > >

    >
    > Sorry, missed out on the closing brace to end the for-loop:
    >
    > function changeSelectMenu(v){
    > document.Testform.Testmenu.length=0;
    > for(i=0;i<v;i++){
    > NewEntry = new Option(i+1,i,false,false);
    > document.Testform.Testmenu.options = NewEntry;
    > }
    > }
    >
    >
    > JW
    >
    >
    >
    Konrad Mathieu, Jul 6, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Miguel Dias Moura
    Replies:
    3
    Views:
    4,278
    Bruno Sirianni
    Apr 3, 2004
  2. Replies:
    7
    Views:
    1,009
  3. naijacoder naijacoder

    How to create dynamic menu with user roles (Treeview menu)

    naijacoder naijacoder, Sep 27, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    336
    naijacoder naijacoder
    Sep 27, 2004
  4. Perry Loh
    Replies:
    0
    Views:
    288
    Perry Loh
    Mar 24, 2006
  5. Lasse Edsvik

    Dynamic Menu with SOThink Menu?

    Lasse Edsvik, Feb 13, 2006, in forum: ASP General
    Replies:
    0
    Views:
    218
    Lasse Edsvik
    Feb 13, 2006
Loading...

Share This Page