onfocus for form input to change border colour?

It'd probably be cleaner to add and subtract a class with the onBlur and onFocus. Then in the css class you could have:

.focus {
background: yellow;
color: #000;
border: 1px solid red;
}

Check here for more information on the border properties. (with apologies to those who hate w3schools, but it's a reasonable place for this type of reference).

http://www.cssdrive.com/index.php/examples/exampleitem/focus_pseudo_class/


Just use css for outline color like so:

.class {
    outline-color:#FF0;
}

you can use the :focus pseudoclass #q:focus {border:red 1px solid;} but as you can see here http://www.quirksmode.org/css/contents.html it's not supported by ie 7 and below. To achieve cross browser compatibility you can use jquery and the following code

$('#q').focus(function() {
    $('#q').css('border','1px solid red');
});