Possible Duplicates:
How do I embed an “a:hover{…}” rule into a style attribute in the middle of a document?
How to write a:hover in inline CSS?
I want to dynamically change the hover colour of an element, but not using external CSS stylesheets, only inline. This is the code (using php to generate the element)
echo '
<div class="container" style="color:#'.$color.'">
'.$contents.'
</div>';
When the user hovers over this container element, the color style will change to the value of $color (at the moment there is no hovering).
Any help would be appreciated.
:hoveris a pseudo class and can really only be used within a stylesheet. You can create a class and assign it via PHP or use some JS to doonmouseoverandonmouseout.