Click to See Complete Forum and Search --> : how do I check property of something?


mitya
10-13-2003, 08:44 AM
Hi all, still learning this javascript lark.

How would I check the 'disabled' status of a form's submit button, and if it's not disabled, allow a rollover?

I have the rollover and everything working fine, but I only want the roll-over to effect if the button is enabled (which depends on another form field being chosen). Although it doesn't rollover and change colour when disabled, it DOES change colour if you drag the button with the mouse when disabled. I assume this is a bug in JS.

I've done some research and tried to build a function with getProperty and getPropertyByID but no joy.

lillu
10-13-2003, 09:09 AM
Just play around this:

<html>
<head>
<script language="javascript">
btn.disabled = true;
</script>
</head>
<body>
<input type="submit" name=btn onclick="if(this.disabled=true)this.blur();" />
<input type="submit" name=btn onclick="if(this.disabled=false)this.focus();" />
</body>
</html>