...

View Full Version : checkbox & css



jcdevelopment
10-29-2007, 07:34 PM
Is there a way to have the checkbox checked when rolled over, or is that a JS thing?

Fang
10-29-2007, 07:45 PM
JavaScript
<input type="checkbox" onmouseover="this.checked=(this.checked)? false : true;">

vtjustinb
10-29-2007, 08:26 PM
Worth mentioning that if you plan on doing this on a group of checkboxes it'd be best to strip out the inline JS and do it in an included file through event handlers.


$$('checkbox-rollovers').forEach(
addEvent('onmouseover',
function() { this.checked=(this.checked)? false : true }
)
);

The above is a Prototype-like syntax but the logic would be the same if you were doing it without a Library.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum