• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Disable Radio buttons

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have some radio buttons combined in one name. Now I want to disable some of these radio buttons depending on the product options selected through select menu. THe following code is working in IE but not with Netscape ( can anyone help me).

var selected=document.form[0].product.options[document.form[0].product.selectedIndex].value;

if(selected=='Music')
{
document.bulkorder.media[0].disabled ="false";
document.bulkorder.media[1].disabled ="false";
document.bulkorder.media[2].disabled ="false";
document.bulkorder.media[3].disabled ="true";
document.bulkorder.media[4].disabled ="true";
document.bulkorder.media[5].disabled ="true";
document.bulkorder.media[6].disabled ="true";
}
else if (selected=='Video')
{
document.bulkorder.media[0].disabled =true;
document.bulkorder.media[1].disabled =true;
document.bulkorder.media[2].disabled =true;
document.bulkorder.media[3].disabled =false;
document.bulkorder.media[4].disabled =false;
document.bulkorder.media[5].disabled =false;
document.bulkorder.media[6].disabled =true;
}
"product" is the name of list box
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The disabled property only works in IE and in netscape 6 or higher. To make it work in an earlier version you'll need to write some code to check the value of 'selected' when they click on one of the buttons and then return true or false to let the action happen or not if it should be enabled or disabled.
hth
Dave
reply
    Bookmark Topic Watch Topic
  • New Topic