homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

New javascript rollover code
validator says it's invalid - why?

10+ Year Member

Msg#: 81 posted 8:57 pm on Apr 9, 2002 (gmt 0)

Hi. I just used some new javascript rollover code, that places part of the code at the end of the page, just before the </HTML> tag. The web validator says this is invalid. Anyone know about this? Thank you!

(edited by: justinen at 9:35 pm (utc) on April 9, 2002)



10+ Year Member

Msg#: 81 posted 9:12 pm on Apr 9, 2002 (gmt 0)

I am going to guess that your URL will be removed from the posting.

But to answer your question:

<script></script> tags go in between the <head></head> tags


10+ Year Member

Msg#: 81 posted 2:40 am on Apr 10, 2002 (gmt 0)

Although with most scripts they will run anywhere.

In fact document.write("hello") works in nearly every browser anywhere (not in the <TD> sections of some of the older browsers). But if you have a function something() {code} and the function is called before the script loads you will get an error. So it is best to make sure the code is high on the page.

And, as pcguru333 said the validator is likely looking for scripts to be in the head section. The validator is not checking the script for errors. But since this is a rollover script i am wondering if it would not in fact give an error if somebody had not downloaded the whole page before having their pointer over whatever is suppose to rollover?


10+ Year Member

Msg#: 81 posted 9:04 pm on Apr 10, 2002 (gmt 0)

Thanks for all your help. I went ahead and moved the code just under the <head>. Problem is in NN it makes the alt command for all my images disappear. It is okay in IE. Any thoughts?


10+ Year Member

Msg#: 81 posted 9:15 pm on Apr 10, 2002 (gmt 0)

I maybe wrong on this, so someone back me up or correct me...

I believe that the alt command is to display text on the page if images are turned off or don't download for whatever reason. End-users that have their PC setup to read the page hear the alt text read to describe the image.

The fact that the tooltip displays the same as the alt attribute is a bug/feature in some browsers.


10+ Year Member

Msg#: 81 posted 9:21 pm on Apr 10, 2002 (gmt 0)

Hi. Maybe I didn't explain this correctly. The alt for each image did work in netscape before I put the rollover code in the head section - it was at the bottom just before the closing html tag (per the instructions of the code writer). Any suggestions?


WebmasterWorld Senior Member 10+ Year Member

Msg#: 81 posted 10:39 pm on Apr 10, 2002 (gmt 0)

A fairly common misconception is that the ALT text is supposed to function as a tooltip: it is not.

Alt text should only appear in place of images providing those using text-only browsers, or simply surfing with images turned-off, a description of the intended image.

Those of us surfing using the Opera browser are already aware of this, as Opera, correctly, does not display the alt-text unless we disable images (keystroke "G" off/on).

The title tag should be used when tool-tips are desired. One neat thing I only recently noticed with Opera is that the displayed "tooltips" (title tag) do not time-out as with MSIE. The "tooltip" will remain visible as long as the cursor is hovering over the active element.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved