?
Solved

XHTML mouseover validation

Posted on 2006-05-04
12
Medium Priority
?
309 Views
Last Modified: 2012-06-27
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?.
0
Comment
Question by:james130c
11 Comments
 
LVL 12

Expert Comment

by:_Maddog_
ID: 16605918
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
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16605975
<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>
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 16607448
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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 49

Expert Comment

by:Roonaan
ID: 16608919
Also for xml onmouseover and onmouseout should be lowercase, shouldn't they be?

-r-
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16608920
Yes, thanks, cut and repeat error
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16608952
That too :|
0
 
LVL 1

Author Comment

by:james130c
ID: 16610189
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.
0
 
LVL 8

Expert Comment

by:KennyTM
ID: 16611920
Hi. Can you show us the source of the function changeImages() ?
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 16612535
James.
In the function changeImages, which will look perhaps like this (if not perhaps it should)
change

function changeImages(imgName,imgSrc) {
  document.images[imgName].src=imgSrc;
}

to

function changeImages(imgId,imgSrc) {
  if (document.getElementById)
    document.getElementById(imgId).src=imgSrc;
}

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16615022
May I ask why a "B" grade?
If my suggestion worked without even having seen your code, I think an "A" is in order...
0
 
LVL 1

Author Comment

by:james130c
ID: 16615183
Sorry you are right... i have put the wrong grade. How can i change it?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question