Jan 24, 2010

"Diable or Enable drop down " in JavaScript

How to disable or enable drop down list in JavaScript?

Just create a dropdown list in html form and have an id (mySelect) for that.
Do control of the drop down list in javascript function using the id.
" document.getElementById("mySelect").disabled=true;  " it means disable the dropdown list and
" document.getElementById("mySelect").disabled=false; " means enable.

File : DisableorEnable_JS.html


<html>
<head>
<script type="text/javascript">
function disable()
{
document.getElementById("mySelect").disabled=true;
}
function enable()
{
document.getElementById("mySelect").disabled=false;
}
</script>
</head>
<body>
<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select><br /><br />
<input type="button" onclick="disable()" value="Disable list">
<input type="button" onclick="enable()" value="Enable list">
</form></body>
</html>


=======================
Publicize yourself ... Free!
http://saalram.com
=======================

No comments:

Post a Comment

Saalram.com

Saalram
Publicize yourself ...
http://saalram.com

Free !!!


Place your Ad here - Free!!!
just drop us a mail ... saalram.service@gmail.com

Free !!!