Avatar of james130c
james130cFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

XHTML mouseover validation

Hi my XHTML document is passed validation, it doesn't pass validation with the 'name' tag, so i changed it to 'id' which is fine for validation, but the mouseover doesn't actually work when i change it to 'id' but it works with 'name' so im a little stuck, can abody tell me a way around this matter?.
JavaScript

Avatar of undefined
Last Comment
james130c
Avatar of _Maddog_
_Maddog_
Flag of United States of America image

Hi james130c,

What do you mean "the mouseover doesn't actually work when i change it to 'id'"?
Can you provide a code sample of what you're trying to accomplish?

- Maddog
Avatar of Michel Plungjan
<a href="#"
onMouseover="document.getElementById('img1').src='img1on.gif'"
onMouseover="document.getElementById('img1').src='img1off.gif'"><img src="img1off.gif" id="img1" border="0" /></a>
Avatar of Saqib Khan
Saqib Khan
Flag of United States of America image

mplungjan You Mean...


<a href="#"
onMouseover="document.getElementById('img1').src='img1on.gif'"
onMouseout="document.getElementById('img1').src='img1off.gif'"><img src="img1off.gif" id="img1" border="0" /></a>


you using mouseover Twice.
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Also for xml onmouseover and onmouseout should be lowercase, shouldn't they be?

-r-
Yes, thanks, cut and repeat error
That too :|
Avatar of james130c
james130c
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Hi, i mean when i use the 'name' tag the mouse over works fine, with the 'id' tag i get an error and the link doesn't change when the mouse goes over it.

<a href="#"
onmouseover="changeImages('top_design_04', 'images/top_design_04-over.gif'); return true;"
onmouseout="changeImages('top_design_04', 'images/top_design_04.gif'); return true;">
<img id="top_design_04" src="images/top_design_04.gif" width="99" height="41" alt=""  /></a>

this is the code im using, validates fine, everything is good except that using 'ID' the mouseover doesn't seem to work i get this error.

document is null or not an object.

But as i said using name="top_design_04" works fine but doesn't validate.
Avatar of KennyTM
KennyTM

Hi. Can you show us the source of the function changeImages() ?
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
May I ask why a "B" grade?
If my suggestion worked without even having seen your code, I think an "A" is in order...
Avatar of james130c
james130c
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Sorry you are right... i have put the wrong grade. How can i change it?
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo