php - onclick change css -


i making simple calendar app in php , want change <td> block style depending on user does. want when "menuclick" class on, other classes stop working until click block. previous block should turned off well. in advance.

echo'<td onclick=classname="menuclick"; onmouseover=classname="menuon"; onmouseout=classname="menuoff";>' . $countday++ . "</td>" 

i think can achieve want using following:

echo '<td onclick="this.classname=\'menuclick\';" onmouseover="this.classname=\'menuon\';" onmouseout="this.classname=\'menuoff\';">' 

http://jsfiddle.net/wdu9v/

seeing though giving jquery answer , jbabey complaining inline js:

$('td').each(function() {     $(this).mouseenter(function() {         $(this).removeclass().addclass('menuon');     });     $(this).mouseleave(function() {         $(this).removeclass().addclass('menuoff');     });     $(this).click(function() {         $(this).removeclass().addclass('menuclick');     });  }); 

http://jsfiddle.net/wdu9v/1/


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -