Jump to content

[SOLVED] W3C Validation and Javascript


amin7b5

Recommended Posts

I am new to Javascript and I downloaded OverLIB for some interesting mouseover effects. I try to build all of my pages so that they will validate on W3C and although the OverLIB script is working fine, the markup to instantiate the mouseover simply will not validate, i think because I'm placing html tags within tags. Here is an example:

 

<a href="javascript:void(0);" onmouseover="return overlib('<img src=\'images/latest_work/aos.jpg\' alt=\'Advanced Overlay Systems\' /><br /><p>This is a little caption box displaying an image and some text.', STICKY, CAPTION, 'Advancedoverlay.com', MOUSEOFF);" onmouseout="return nd();"><img src="images/latest_work/aos.jpg" alt="Advanced Overlay Systems" /></a>

 

If there is anyway to get this markup to validate, I'd love to find out! I wasn't sure if this belongs in the javascript or html forum, but since it involves a script I figured I'd start here.

 

Thanks in advance to any help.

Link to comment
Share on other sites

Here's all seven errors from the validator!

 

#  Line 41, Column 62: XML Parsing Error: Unescaped '<' not allowed in attributes values.

…id(0);" onmouseover="return overlib('<img src=\'images/latest_work/aos.jpg\' 

✉
# Error Line 41, Column 62: XML Parsing Error: attributes construct error.

…id(0);" onmouseover="return overlib('<img src=\'images/latest_work/aos.jpg\' 

✉
# Error Line 41, Column 62: XML Parsing Error: Couldn't find end of Start Tag a line 41.

…id(0);" onmouseover="return overlib('<img src=\'images/latest_work/aos.jpg\' 

✉
# Error Line 41, Column 71: XML Parsing Error: AttValue: " or ' expected.

…nmouseover="return overlib('<img src=\'images/latest_work/aos.jpg\' alt=\'Adv

✉
# Error Line 41, Column 71: XML Parsing Error: attributes construct error.

…nmouseover="return overlib('<img src=\'images/latest_work/aos.jpg\' alt=\'Adv

✉
# Error Line 41, Column 71: XML Parsing Error: Couldn't find end of Start Tag img line 41.

…nmouseover="return overlib('<img src=\'images/latest_work/aos.jpg\' alt=\'Adv

✉
# Error Line 41, Column > 80: XML Parsing Error: Opening and ending tag mismatch: div line 37 and a.

…r="return overlib('<img src=\'images/latest_work/aos.jpg\' alt=\'Advanced Ove…

Link to comment
Share on other sites

Replase all of these:

 

<

 

with this:

 

<

 

and replace all these:

 

>

 

with this:

 

>

 

 

That will solve some of your errors, maybe even all of them (if not, post the new/remaining errors after doing this).

 

There is also the possibility your code won't work after doing this, though I think it should. If it doesn't work after making these changes, then you will have to revert back to the way it was before, and move your javascript to external files (which I personally prefer anyways).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.