Welcome to WebmasterWorld Guest from 54.167.78.17

Forum Moderators: incrediBILL

Message Too Old, No Replies

Can't get code to validate

     
3:43 am on Feb 26, 2011 (gmt 0)

New User

joined:Feb 26, 2011
posts:1
votes: 0


Never have done rollover images, everything i find shows it using a "name" attribute, even some javascipt i found, and that the only thing I can not get to validate and its driving me crazy. Can someone please help, or point me towards a better way to do the rollover?

using:
<!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">

only issue is with each rollover link, the "name" wont validate and only shows 1 error, but Say i remove the first attribute "name", it will than show the second one as an error. and removing "name" renders it useless because it wont roll over


<div id="nav">
<a href="index.html"><img src="images/navlinks/homeact.gif" alt="home link" /></a>
<a href="pages/wedding/wedding.html" onmouseover="document.wed.src='images/navlinks/weddingact.gif'"
onmouseout="document.wed.src='images/navlinks/wedding.gif'">
<img src="images/navlinks/wedding.gif" alt="wedding link" name="wed"/></a>
<a href="pages/engagement/engagement.html" onmouseover="document.eng.src='images/navlinks/engagementact.gif'"
onmouseout="document.eng.src='images/navlinks/engagement.gif'">
<img src="images/navlinks/engagement.gif" alt="engagement link" name="eng"/></a>
<a href="pages/seniors/seniors.html" onmouseover="document.sen.src='images/navlinks/seniorsact.gif'"
onmouseout="document.sen.src='images/navlinks/seniors.gif'">
<img src="images/navlinks/seniors.gif" alt="seniors link" name="sen"/></a>
<a href="pages/families/families.html" onmouseover="document.fam.src='images/navlinks/familiesact.gif'"
onmouseout="document.fam.src='images/navlinks/families.gif'">
<img src="images/navlinks/families.gif" alt="families link"name="fam"/></a>
<a href="pages/children/children.html" onmouseover="document.chi.src='images/navlinks/childrenact.gif'"
onmouseout="document.chi.src='images/navlinks/children.gif'">
<img src="images/navlinks/children.gif" alt="children link" name="chi"/></a>
<a href="pages/event/event.html" onmouseover="document.eve.src='images/navlinks/eventact.gif'"
onmouseout="document.eve.src='images/navlinks/event.gif'">
<img src="images/navlinks/event.gif" alt="event link" name="eve"/></a>
<a href="pages/about/about.html" onmouseover="document.about.src='images/navlinks/aboutact.gif'"
onmouseout="document.about.src='images/navlinks/about.gif'">
<img src="images/navlinks/about.gif" alt="about link" name="about"/></a>
<a href="pages/contact/contact.html" onmouseover="document.con.src='images/navlinks/contactact.gif'"
onmouseout="document.con.src='images/navlinks/contact.gif'">
<img src="images/navlinks/contact.gif" alt="contact link" name="con"/></a>
</div>
9:55 am on Feb 26, 2011 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 2, 2003
posts:948
votes: 4


Hi there huntt3,

and a warm welcome to these forums. ;)

The use of javascript for link rollovers is twentieth century methodology and should not be used.

Check out these links for CSS methods...
  1. [wellstyled.com ]
  2. [webvamp.co.uk ]
  3. [alistapart.com ]
  4. [css-tricks.com ]

birdbrain
11:01 am on Feb 26, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Do you really need the XHTML DOCTYPE?

Would HTML 4.01 make your life simpler?
10:26 pm on Feb 27, 2011 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts: 159
votes: 0


Older browsers need the name attribute but newer ones need ID. To satisfy everyone, use both name and ID and make them match and unique per page. It should then work with JavaScript or CSS and Doctype of HTML or XHTML.
2:06 am on Feb 28, 2011 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9063
votes: 2


Older browsers need the name attribute but newer ones need ID.


There are basically none of these "older browsers" around any more - there is no need at all to use the
name
attribute any more.
2:24 am on Feb 28, 2011 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts: 159
votes: 0


Encyclo, I used to believe that such old browsers were gone, too. A coworker at the University of Michigan was teaching a computer class and found that nearly 1/3 of her class couldn't even see her pages. She was using the newest stuff and they were using WebTV!
2:32 am on Feb 28, 2011 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9063
votes: 2


Anyone using WebTV these days will find that vast swathes of the web are unusable. There are always a few edge cases, but I've not seen WebTV or any old browsers in any stats for many years. You have to draw the line somewhere, and for me WebTV is way over the other side of that line. :)
2:45 am on Feb 28, 2011 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts: 159
votes: 0


Could she draw the line at losing 1/3 of paying students? It was a language class not web-related except in the sense that it was on-line. To keep her job teaching the class, she had to make her pages available to all her students. The "line" she had to draw was whether or not she wished to get paid.