我用onmouseover在我的网页上切换图片。 当我使用IE谷歌chorome和safari时,这是有效的,但是当使用Firefox时,脚本无法正常工作,我希望你们能帮助我。 -lars
HTML:
<table id='bedrijfen_tabel' class='alinea'>
<thead>
<tr><th>Bedrijf</th><th>Lokatie</th><th>Opgericht</th><th>Website</th></tr>
</thead>
<tbody>
<tr id='google' onmouseover="showlogo();"><td>Google</td><td>1600 Amphitheatre Parkway Mountain View</td><td>4 september 1998</td><td><a href="www.google.com">www.google.com</a>
<tr id='facebook' onmouseover="showlogo();"><td>Facebook</td><td>1 Hacker Way, Menlo Park 94025</td><td>4 februari 2004</td><td><a href="www.facebook.com">www.facebook.com</a>
</tbody>
</table>
JavaScript的:
function showlogo(){
bedrijf = event.currentTarget.id;
foto = document.getElementById("logo");
logo.src = "images/" + bedrijf + ".jpg";
logo.alt = bedrijf;
}