I’ve got a css/html menu, now I want to execute this PHP-Script every time the button is hovered by the user:
CSS:
background: <?php printf( "#%06X\n", mt_rand( 0, 0xFFFFFF )); ?>;
This is in my css. It’s getting correctly called when I reload the page, but the color stays the same even if I hover the button… How can I change this?
Thanks a lot!
PHP is only executed once on the server.
You can reproduce what you want with Javascript (preferably jQuery).
See this answer. jquery random color hover