In javascript chained select menus are available.first
select menu is worked and others are disabled.when we
select any one option then the next select menu will worked
having option releated to selcted in first select menu.How
it possible? what is the coading of this programme?

Answer Posted / mangala bhat

It possible by using onChange event.

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function change()
{

var cat = document.getElementById("category");
if(cat.value =="Javascript")
{


document.getElementById("javaScript").removeAttribute("disabled");

document.getElementById("java").setAttribute("disabled","true");
}
else
{

document.getElementById("javaScript").setAttribute("disabled","true");
document.getElementById("java").removeAttribute("disabled");

}
}
</script>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Html menu</title>
</head>
<body>
Category :<select id="category" name = "category"
onChange=change();>
<option value="Select">Select ...</option>
<option value="Javascript">Javascript</option>
<option value="Java">Java</option>
</select>
&nbsp;
JavaScript:<select id="javaScript" name = "javaScript"
disabled="disabled" >
<option value="JS Objects"> JS Objects</option>
<option value = "JS Advanced">JS Advanced</option>
</select>
&nbsp;
Java:<select id="java" name = "java" disabled="disabled" >
<option value="Java Swings"> Java Swings</option>
<option value = "Java Collections">Java Collections</option>
</select>
</body>
</html>

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the main uses of javascript?

566


Explain javascript event delegation model?

601


Describe javascript and vbscript.

595


What can I build with javascript?

579


Should I learn java first or javascript?

582






What is this? Var myarray = [[[]]];

673


Why javascript is called as script for all browsers?

549


What does the attribute defer/async do when added to the script tag?

639


How to detect the operating system on the client machine?

566


Describe what u had done today?

1895


accessdenied javanet disconnet

1643


What are Cookies in Javascript?

652


a code in vb script, which creates a table of 5*2 in html this is a static table, one more same dynamic table, as we give input the table should get created.

1180


How do I link an external javascript file to html?

542


What is a class in javascript?

570