as I said I wanted to add onmousedown or onclick in select tag so that when I select an option from select tag, it'll fire up a function which will make visibility to another html tag, like a div tag! I used css to make the div tag's visibility to none! When the relevant option is clicked, I want to show up that div tag in my page but it doesn't work the way I want! I think, the code and a screen shot might help you guys to detect what I am not getting right in the code! Please, help me in this regard!
<html>
<head>
<title>Something</title>
</head>
<body>
<script>
function mouseDown(){
var element1 = document.getElementById("Nl").value;
var element2 = document.getElementById("bld").value;
var element3 = document.getElementById("hspt").value;
var changing = document.getElementById("Hp");
var changingV2 = document.getElementById("BB");
if(element3 == "Hospitals"){
changing.style.display = "block";
changingV2.style.display = "none";
}
if(element2 == "bloodBanks"){
changing.style.display = "none";
changingV2.style.display = "block";
}
/*else
document.write("nothing should happen!");*/
}
</script>
<select id = "cate">
<option id = "Nl" value = "" onclick = "ClickToChange()"></option>
<option id = "hspt" value = "Hospitals" onclick = "ClickToChange()">Hospital</option>
<option id = "bld" value = "bloodBanks" onclick = "ClickToChange()">Blood Bank</option>
</select>
<br>
<br>
<br>
<br>
<div id = "Hp" style = "display:none">
<div>Hospital</div>
<input id = "hosital" type = "text" maxlength = "40">
</div>
<div id = "BB" style = "display:none">
<div>Blood Banks</div>
<input id = "bloodbank" type = "text" maxlength = "40">
</div>
</body>
</html>