Avatar billede zkizo Nybegynder
09. oktober 2003 - 17:59 Der er 7 kommentarer og
1 løsning

En "hover" effekt

Når man markere punkterne med et "." foran skal den hove til 294563.. ex på tekst ". Links" skal hove til 294563. Alle uden "." foran skal altså IKKE hove.. Koden:

<tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2"><b>Information</b></font></td>
            </tr>
            <tr>
              <td width="100%" ><font color="#FFFFFF" face="Verdana" size="2">.
                About us</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                The Crew</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Contact</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2"><b>Downloads</b></font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Maps</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Server stuff</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Pod Bot</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Misc</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF"><b>Misc.</b></font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF">.
                Links&nbsp;</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF">.
                Forum</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF">.
                Condition Zero</font></td>
            </tr>
Avatar billede medions Nybegynder
09. oktober 2003 - 17:59 #1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>Untitled</title>
    <script language="JavaScript">
            function colorThis(what, color) {
                document.getElementById(what).style.backgroundColor= color;
            }
    </script>
</head>

<body bgcolor="#000000">

<table>
              <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2"><b>Information</b></font></td>
            </tr>
            <tr>
              <td width="100%" id="1" onmouseover="colorThis(this.id, '#294563');" onmouseout="colorThis(this.id, '#000000');"><font color="#FFFFFF" face="Verdana" size="2">.
                About us</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                The Crew</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Contact</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2"><b>Downloads</b></font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Maps</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Server stuff</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Pod Bot</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Misc</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF"><b>Misc.</b></font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF">.
                Links&nbsp;</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF">.
                Forum</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF">.
                Condition Zero</font></td>
            </tr>
            </table>

</body>
</html>


//>Rune
Avatar billede medions Nybegynder
09. oktober 2003 - 18:00 #2
Det her er lidt bedere:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>Untitled</title>
    <script language="JavaScript">
            function colorThis(what, color) {
                what.style.backgroundColor= color;
            }
    </script>
</head>

<body bgcolor="#000000">

<table>
              <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2"><b>Information</b></font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font color="#FFFFFF" face="Verdana" size="2">.
                About us</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                The Crew</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Contact</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2"><b>Downloads</b></font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Maps</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Server stuff</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Pod Bot</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2">.
                Misc</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF"><b>Misc.</b></font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF">.
                Links&nbsp;</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF">.
                Forum</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF">.
                Condition Zero</font></td>
            </tr>
            </table>

</body>
</html>

//>Rune
Avatar billede medions Nybegynder
09. oktober 2003 - 18:01 #3
Altså alt i alt:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>Untitled</title>
    <script language="JavaScript">
            function colorThis(what, color) {
                what.style.backgroundColor= color;
            }
    </script>
</head>

<body bgcolor="#000000">

<table>
              <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2"><b>Information</b></font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font color="#FFFFFF" face="Verdana" size="2">.
                About us</font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font color="#FFFFFF" face="Verdana" size="2">.
                The Crew</font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font color="#FFFFFF" face="Verdana" size="2">.
                Contact</font></td>
            </tr>
            <tr>
              <td width="100%"><font color="#FFFFFF" face="Verdana" size="2"><b>Downloads</b></font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font color="#FFFFFF" face="Verdana" size="2">.
                Maps</font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font color="#FFFFFF" face="Verdana" size="2">.
                Server stuff</font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font color="#FFFFFF" face="Verdana" size="2">.
                Pod Bot</font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font color="#FFFFFF" face="Verdana" size="2">.
                Misc</font></td>
            </tr>
            <tr>
              <td width="100%"><font face="Verdana" size="2" color="#FFFFFF"><b>Misc.</b></font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font face="Verdana" size="2" color="#FFFFFF">.
                Links&nbsp;</font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font face="Verdana" size="2" color="#FFFFFF">.
                Forum</font></td>
            </tr>
            <tr>
              <td width="100%" onmouseover="colorThis(this, '#294563');" onmouseout="colorThis(this, '#000000');"><font face="Verdana" size="2" color="#FFFFFF">.
                Condition Zero</font></td>
            </tr>
            </table>

</body>
</html>


//>Rune
Avatar billede olebole Juniormester
11. oktober 2003 - 05:46 #4
<ole>

Og en smule mere 'sexy':

<script language="JavaScript">
    var hi="#ffffff", lo="#000000";
    function colorThis(elm, inout) {
        document.getElementById(elm).style.backgroundColor = (inout)? hi : lo;
    }
</script>

... og en tabelcelle:

<td width="100%" onmouseover="colorThis(this, 1);" onmouseout="colorThis(this, 0);">

Så skal farverne kun rettes ét sted (hvis altså de to farver altid er de samme over hele siden).

/mvh
</bole>
Avatar billede medions Nybegynder
11. oktober 2003 - 15:41 #5
??? Ole, hvad gør hi : lo ?

//>Rune
Avatar billede olebole Juniormester
11. oktober 2003 - 19:40 #6
Det er de to farver ( hvor hi = hover-farven ):
  var hi="#ffffff", lo="#000000";
/mvh
Avatar billede olebole Juniormester
11. oktober 2003 - 19:42 #7
... og så bruger jeg en short-hand for en if/else:

if ( betingelse ) {
  bla = "noget";
} else {
  bla = "noget andet";
}

kan skrives:

bla = ( betingelse )? "noget" : "noget andet";
Avatar billede medions Nybegynder
11. oktober 2003 - 20:05 #8
Ok :)

Ole, skriver du ik' lgie en mail til mig på rune@medions.dk

//>Rune
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