Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Dynamic HTML-Menu

Reply
Thread Tools

Dynamic HTML-Menu

 
 
Konrad Mathieu
Guest
Posts: n/a
 
      07-06-2003
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[i] = 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


 
Reply With Quote
 
 
 
 
Janwillem Borleffs
Guest
Posts: n/a
 
      07-06-2003

"Janwillem Borleffs" <(E-Mail Removed)> schreef in bericht
news:3f08372b$0$28890$(E-Mail Removed)...
>
> 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[i] = 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[i] = NewEntry;
}
}


JW



 
Reply With Quote
 
 
 
 
Konrad Mathieu
Guest
Posts: n/a
 
      07-06-2003
Great one! Thanks!
Cheers,
Konrad



"Janwillem Borleffs" <(E-Mail Removed)> schrieb im Newsbeitrag
news:3f08389f$0$28902$(E-Mail Removed)...
>
> "Janwillem Borleffs" <(E-Mail Removed)> schreef in bericht
> news:3f08372b$0$28890$(E-Mail Removed)...
> >
> > 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[i] = 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[i] = NewEntry;
> }
> }
>
>
> JW
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Variables? OR Dynamic Controls =?Utf-8?B?VGVyb3M=?= ASP .Net 1 08-10-2004 01:13 PM
Dynamic control on aspx page, dynamic location Chris Thunell ASP .Net 3 07-21-2004 04:52 PM
VPN between 2 Cisco routers (1 static, 1 dynamic) with access from stat --> dynamic over ISDN Hans-Peter Walter Cisco 3 01-21-2004 02:12 PM
Does Pix or cisco router support dynamic-to-dynamic IPSec VPN? c Cisco 2 01-13-2004 01:53 AM
Re: Dynamic Table with Dynamic LinkButtons Rick Glos ASP .Net 0 07-08-2003 01:09 PM



Advertisments