Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> DIV i hover, niezgodność z Validatorem
3miel
post
Post #1





Grupa: Zarejestrowani
Postów: 203
Pomógł: 0
Dołączył: 10.06.2004
Skąd: Gliwice

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


Witam,

mam w stronce taki fragment tekstu:
Kod
<div class="mg_l" onMouseOver="this.style.backgroundColor='#CDE288';" onMouseOut="this.style.backgroundColor='';"><a href="#">...</a></div>


i validator wywala taki bład:
Error Line 32 column 30: there is no attribute "onMouseOver".
<div class="mg_l" onMouseOver="this.style.backgroundColor='#CDE288';" onMouseOut
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.


Domyślam się że należy zrobić taki sam efekt ale przy użyciu stylów, tylko jak zrobić w stylach, że po najechaniu na div, zmieni sie jego tlo? .mg_l:hover nie działa.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
skl
post
Post #2





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 16.11.2006

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


Witam
To moj pierwszy post na forum wiec chcialem sie przywitac. I jednoczesnie zadac pytanie.
Jeszcze raczkuje w css , robie pierwsza swoja strone. Jest juz na finiszu, tylko pojawily sie problemy z IE :|

jednym z problemow jest onmouseover Zrobilem to w xhtmlu w ten sposob:

Kod
<a class="link" href="index.php?pokaz=domyslna" onmouseover='domyslna.src="menu_04b.jpg"'onmouseout='domyslna.src="menu_04.jpg"'><img height="29" name="domyslna" id="domyslna" src="menu_04.jpg" width="210" align="top" border="0"></a>


Dziala pod ff. Pod IE wyskakuje komunikat, ze IE zablokowal aktywna zawartosc strony poniewaz jest niebezpieczna. Czytalem hack podany przez mike_mech , jednak jako, ze css jest dla mnei jeszcze niedostatecznie zrozumialy, to css opisywany po angielsku tym bardziej :| Czy jest jakis sposob by to inaczej napisac, tak zeby dzialalo z MSIE?
Go to the top of the page
+Quote Post
Zajec
post
Post #3





Grupa: Zarejestrowani
Postów: 1 086
Pomógł: 8
Dołączył: 10.12.2003

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


Przede wszystkim w drzewie DOM nie ma czegoś takiego jak "domyslna". Odwołuj się do elementów w dokumencie przez np. id.

Kod
document.getElementById('identyfikator').src='blabla';


Zauważ, że wielkość liter (np. w getElementById) jest istotna.
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 26.09.2025 - 15:05