Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Zmiana obrazka po najechaniu, zgodne z W3?
-Wieviór-
post
Post #1





Goście







Ogólnie chodzi o pasek pod logiem, na którym są obrazki typu "Home | Forum | Kontakt" itp. itd.

Do tej pory robiłem to tak:

  1. <div class="przycisk"><a href="" onMouseOver='rollover2.src="on.gif"' onMouseOut='rollover2.src="off.gif"'><img src="off.gif" name="rollover2" border="0"/></a></div>


Vadilator W3 jednak pokazuje mi błąd:
  • there is no attribute "onMouseOver".
  • there is no attribute "onMouseOut".
  • there is no attribute "name".

Zna ktoś dobry, prosty sposób na zrobienie czegoś takiego by Vadilator się nie czepiał?

Mój Doctype:
Kod
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
Go to the top of the page
+Quote Post
czachor
post
Post #2





Grupa: Zarejestrowani
Postów: 897
Pomógł: 40
Dołączył: 16.12.2003
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


"onmouseover" a nie "onMouseOver" i to samo z "onmouseout"
"id" a nie "name"


--------------------
how many SEO experts does it take to change a light bulb,lightbulb,light,bulb,lamp,lighting,switch,sex,xxx
5-Reasons-why-you-should-NEVER-fix-a-computer-for-free
Go to the top of the page
+Quote Post
woj_tas
post
Post #3





Grupa: Zarejestrowani
Postów: 230
Pomógł: 36
Dołączył: 31.03.2006
Skąd: Zielona Góra

Ostrzeżenie: (0%)
-----


Najprościej:

html:
  1. <a href="" title=""></a>


css:
  1. a {width:x; height:y; background:url('images/z.jpg') no-repeat;}
  2. a:hover { background:url('images/z-hover.jpg') no-repeat;}


Troche lepiej:

html:
  1. <a href="" title="Kontakt">Kontakt</a>


css:
  1. a {width:x; height:y; background:url('images/kontakt.jpg') left top no-repeat; float:left; text-indent:-9999px;}
  2. a:hover { background:url('images/z-hover.jpg') left bottom no-repeat;}


W drugim przypadku zasada polega na tym zeby po najechaniu nie wczytywać nowego obrazka, tylko przesunąć ten który już jest.


Pozdrawiam


--------------------
Go to the top of the page
+Quote Post
-Wieviór-
post
Post #4





Goście







Cytat(czachor @ 15.01.2008, 20:40:49 ) *
"onmouseover" a nie "onMouseOver" i to samo z "onmouseout"
"id" a nie "name"


Taka głupota? :]

Ten Vadilator W3 to jest jednak sztywniak biggrin.gif

Dzięki za pomoc ;]
Go to the top of the page
+Quote Post
punkomuzykant
post
Post #5





Grupa: Zarejestrowani
Postów: 147
Pomógł: 3
Dołączył: 28.12.2007
Skąd: toronto

Ostrzeżenie: (0%)
-----


Dawno nie bawiłem się w html ale na Twoim miejscu zamiast tej starej metody sprawdziłbym to
Kod
<pre><script type="text/javascript">
if (document.images)
{
     image1 = new Image;
     image2 = new Image;
     image1.src = "enter1.gif";
     image2.src = "enter2.gif";
}

function chgImg(name, image)
{
     if (document.images)
     {
         document[name].src = eval(image+".src");
     }
}
</script>

...

<a href="/" onMouseOver='chgImg("enter", "image2")'
onMouseOut='chgImg("enter", "image1")'><img name="enter"
src="enter1.gif" border="0" alt="Enter if you dare!"></a></pre>


źródło bardzo wiarygodne więc warto zobaczyć
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 13:08