PDA

View Full Version : Disable click on button


ijrr
09-04-2006, 05:51 PM
Hello!
Is there any way to disable the click effect on a button? I tryed to cancel the onmousedown, click and onmouseup events, but didnt work.
The purpose is to disable the button (but I cant just use disabled attribute because it changes the text style...).
Thanks!

erisco
09-04-2006, 06:52 PM
it changes the text style... really is that much of an issue?

ijrr
09-04-2006, 07:56 PM
Yes, because of the style used on the button... when its disabled, the text canīt be read...
Thats why I have to disable it by hard, applying my own disabled-style.
Any idea?
Thanks!

_Aerospace_Eng_
09-04-2006, 08:28 PM
Just change the class of the button onclick. Style the class anyway you like.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
.disabled {
background:#F00;
color:#000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
</style>
</head>

<body>
<form>
<input type="button" onClick="this.disabled = 1;this.className = 'disabled'" value="Click">
</form>
</body>
</html>

ijrr
09-05-2006, 01:30 PM
The problem is the caption of the button. Its grayed (windows default...).
I cant use disabled attribute, because of this effect. I have to disable the button click(it shouldnt be pressed) by hard.
Any idea?