document.addEvent('domready', function(){ $$('input, textarea').addEvent('focus', function(){ $$('input, textarea').removeClass('focused'); $(this).addClass('focused'); }) });
<form id="commentform" action="" method="get"> <p> <label for="name">Name : </label> <input id="name" name="name" tabindex="1" type="text"> </p> <p> <label for="email">Email : </label> <input id="email" name="email" tabindex="2" type="text"> </p> <p> <label for="url">Website :</label> <input id="url" name="url" tabindex="3" type="text"> </p> <p> <label for="comment">Comment :</label> <textarea id="comment" name="comment" cols="" rows="" tabindex="4"></textarea> </p> <p align="center"> <input name="submit" type="button" tabindex="5" value="Submit"> </p> </form>
<!-- body{ font-family: Verdana, Geneva, sans-serif; font-size: 12px; } #commentform{ border: 1px solid #cac9b9; padding: 5px; width: 450px; } #commentform p { margin-bottom: 5px; } #commentform label { float: left; width: 80px; } #commentform input,#commentform textarea { border: 1px solid #cac9b9; background: #fff; } #commentform textarea{ width: 200px; } #commentform .focused { border:1px solid #888; background-color: #ffffaa; /*css3 outline*/ outline: 2px solid #ffffaa; } -->