
Originally Posted by
sunny
Does It Mean That i'll have to specify a function for mouseover/out
Yes.
and link it to images and substitute these (form) buttons with those mouse over/out images.
No, not at all. The functions will just alter the CSS rule that applies to the button.
Code:
function setColours(object, foreground, background) {
var style;
if((style = object.style)) {
if('string' == typeof foreground) {style.color = foreground;}
if('string' == typeof background) {style.backgroundColor = background;}
}
}
HTML Code:
<input class="button" type="submit" value="Submit Form"
onmouseover="setColours(this, 'red', 'black');"
onmouseout="setColours(this, '', '');">
The first call that occurs with the mouseover event sets the foreground ('red') and background ('black') colours through the inline style object, overriding the values supplied by the style sheet. The second call that occurs with the mouseout event sets empty strings for both colours. This effectively removes the overrides, allowing the original colours to be used.
Mike
Bookmarks