Click to See Complete Forum and Search --> : Disabling form elements
karlmcauley
08-12-2003, 04:55 AM
Although my initial wants are to do this through ASP i am thinking that JScript would be better, but alas i know v little jscript. Can anyone help with the link below?
http://forums.webdeveloper.com/showthread.php?s=&threadid=15231
Many thanks
Khalid Ali
08-12-2003, 10:00 AM
If you want to use server side with AP thne Dave's solution will work.
On the client side you will need to set the disabled property for any html element you want to be disabled.
<input type="text" disabled="disabled">
You can change it dynamically (mouse over the button):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Attribute "disabled"</title>
<script type="text/javascript">
<!--
function Change() {
var obj=document.getElementById("myName");
if (obj.hasAttribute("disabled")) {
obj.removeAttribute("disabled");
}
else {
obj.setAttribute("disabled", "disabled");
}
}
//-->
</script>
</head>
<body>
<form name="MyForm">
<input type="text" id="myName" name="myName" value="possibly"/><br />
<button type="button" onmouseover="Change()">Change</button>
</form>
</body>
</html>