Exemple d'équivalence, parce que j'aime bien faire des petites démos de prototype.js (que les amateurs d'autres librairies JS n'hésitent pas, voir de petits exemples comme ça peut parfois aider ceux qui cherchent à se décider) :
Code PHP :
<?php
<td align="center" valign="middle" onMouseOver="change_txt('demo','11/10 ')" onMouseOut="restaure('demo')"></td>
<td align="center" valign="middle" onMouseOver="change_txt('demo','12/10 ')" onMouseOut="restaure('demo')"></td>
<td align="center" valign="middle" onMouseOver="change_txt('demo','13/10 ')" onMouseOut="restaure('demo')"></td>
<td align="center" valign="middle" onMouseOver="change_txt('demo','14/10 ')" onMouseOut="restaure('demo')"></td>
<td align="center" valign="middle" onMouseOver="change_txt('demo','15/10 ')" onMouseOut="restaure('demo')"></td>
<td align="center" valign="middle" onMouseOver="change_txt('demo','16/10 ')" onMouseOut="restaure('demo')"></td>
<td align="center" valign="middle" onMouseOver="change_txt('demo','17/10 ')" onMouseOut="restaure('demo')"></td>
<td align="center" valign="middle" onMouseOver="change_txt('demo','18/10 ')" onMouseOut="restaure('demo')"></td>
Code PHP :
<?php
// Javascript (prototype.js)
$$('td.demo').each(function(td) {
$w(td.className).each(function(className) {
var matches = className.match(/c-(\d+)-(\d+)/);
if (matches) {
Event.observe(td, "mouseover", function(event){ change_txt('demo', matches[1]+'/'+matches[2]) });
Event.observe(td, "mouseout", function(event){ restaure('demo') });
return $break;
}
});
// CSS
td.demo {
vertical-align: middle;
text-align: center;
}
// HTML
<td class="demo c-11-10"></td>
<td class="demo c-12-10"></td>
<td class="demo c-13-10"></td>
<td class="demo c-14-10"></td>
<td class="demo c-15-10"></td>
<td class="demo c-16-10"></td>
<td class="demo c-17-10"></td>
<td class="demo c-18-10"></td>