Avatar billede sunesune Nybegynder
06. april 2004 - 10:55 Der er 7 kommentarer

Skift baggrund på table

Hvordan får man en table til at skifte farve når man fører musen over vha. styles/CSS???
Avatar billede cdc Novice
06. april 2004 - 10:59 #1
er der et link i cellen ?
Avatar billede dinkie Nybegynder
06. april 2004 - 11:04 #2
<td onmouseover="this.style.bgColor='red'">
Avatar billede fennec Nybegynder
06. april 2004 - 11:09 #3
<td onmouseover="this.style.backgroundColor='#FFFFFF'"></td>
Avatar billede steen_hansen Forsker
06. april 2004 - 11:19 #4
Eller i CSS:

a.menu, a.menu:link, a.menu:visited {
width: 100%;
display: block;
font-family: geneva, verdana, helvetica, arial;
font-weight: none;
font-size: 11px;
color: #e7e7e7;
background-color: #6b707b;
}
a.menu:hover {
color: #000000;
background-color: #b1b5bc;
}
Avatar billede steen_hansen Forsker
06. april 2004 - 11:20 #5
<a href="#" class="menu">Link</a>
Avatar billede steen_hansen Forsker
06. april 2004 - 13:25 #6
Rettelse: <td><a href="#" class="menu">Link</a></td>
Avatar billede roenving Novice
06. april 2004 - 20:34 #7
Hele tabellen ?-)

Her er den inklusive nødudgang !o]

<script type="text/javascript">
function findParent(elm,tag){
for(e=elm;e.tagName!=tag&&e.tagName!='BODY';e=e.parentNode);
return e;
}
</script>
<table style="background:#abc;border-collapse:collapse;">
  <tr>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
  </tr>
  <tr>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
  </tr>
  <tr>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
    <td onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#abc'">
      tekst</td>
  </tr>
</table>

<a onmouseover="findParent(this,'TABLE').style.backgroundColor='#23f'" onmouseout="findParent(this,'TABLE').style.backgroundColor='#fff'">
andet</a>
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester