Jump to content
Sign in to follow this  
Andynic

<img> tag in javascript comment

Recommended Posts

Hi,
Does anyone have any idea why the W3 validation service returns the error shown below on this comment line?/* Set the values in the <img> tag so the user can see a mini-sample of what was selected */Error:=====Line 219, Column 40: required attribute "src" not specified… /* Set the values in the <img> tag so the user can see a mini-sample …✉The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.=====I've tried /* */ to enclose the comment and also //Thanks for your help.andynic

 

Share this post


Link to post
Share on other sites

It sounds like you're using a doctype like XHTML that requires Javascript code to be wrapped in CDATA comments or something like that.

Share this post


Link to post
Share on other sites
Thanks. That was it.
Probelm solved:
mismatch in <header> of the "comment" tokens <!-- ... //--> between <script> and </script> tags:
probelm code:
<script type="text/javascript">
<!--
javascript functions....
-->
</script>
Corrected:
<script type="text/javascript">
<!--
javascript functions....
//-->
</script>
andynic

Share this post


Link to post
Share on other sites

Unless you're doing something else you haven't mentioned, comment tags like that have been obsolete for 10-12 years.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...