homepage Welcome to WebmasterWorld Guest from 54.196.162.238
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
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?
justinen




msg:1481538
 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)

 

pcguru333




msg:1481539
 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

wasmith




msg:1481540
 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?

justinen




msg:1481541
 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?

pcguru333




msg:1481542
 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.

justinen




msg:1481543
 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?

papabaer




msg:1481544
 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