Hi, I am a javascript newbie and wonders how to do this: I want to change this: .buttons a, .buttons button{ background-color:#f5f5f5; PHP: to this .buttons a, .buttons button{ background-color:#000000; PHP: when enter is clicked when the form field is focued (to make it behave like a button). Anyone knows how to do this? This is the code for the button BTW: <div class="buttons"> <a href="#" onclick="this.blur();parent.document.forms[0].submit();"> Search </a> </div> </form> PHP:
<div class="buttons"> <a href="#" onclick="this.style.backgroundColor="#000000";this.blur();parent.document.forms[0].submit();"> Search </a> </div> </form> Code (markup):
and I may be wrong but I dont think you need the ".buttons button" part... i'm pretty sure it does nothing. Unless there is some browser that assumes a link is a button, and even so there is still no 'button' tag...
Just throwing my 2 cents out there, I would go with the css way of doing this. It's not only easy to implement / change it's also supported by every browser and will work even if the user has javascript disabled