Onmouseover
Har en tabellcell med en bakgrundsbild på. Det jag vill göra är att bakgrundsbilden ska ändras vid onmouseover. Denna kod har jag kommit till så långt, men den byter inte bakgrundsbilden :(
<code>
<td style="background: url(../Bilder/bild.jpg); width: 140px" onMouseOver="this.style.background='../Bilder/bild2.jpg'; background-repeat: no-repeat" onMouseOut="document.body.background='../Bilder/bild.jpg'; background-repeat: no-repeat" align="center" height="30">
<a style="text-decoration: none; color: #009900; font-weight:bold; font-size:x-small" href="default.aspx">Start</a>
</td>
</code>
Svara
Sv: Onmouseover
åtminstone så funkar ju inte <b>background-repeat:no-repeat</b> som javascript
testa med
1 | onmouseover = "this.style.background='../Bilder/bild2.jpg';this.style.backgroundRepeat='no-repeat'" |
Svara
Sv: Onmouseover
Här blandas det vilt, ser jag. ;)
Så:
onMouseOver="this.style.background='url(../Bilder/bild2.jpg) no-repeat"
Eller så:
onMouseOver="this.style.backgroundImage='url(../Bilder/bild2.jpg)'; this.style.backgroundRepeat='no-repeat';"
Svara