Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problems validating JS code

    We are trying to validate a piece of code on our HTML pages and get the following message - "The text content of element script was not in the required format: Expected space, tab, newline, or slash but found < instead."

    The code is used to set up the Facebook tags in JavaScript, and does work by itself. However, we're trying to get it to work through validation on http://validator.w3.org

    Code:
    <script src="SiteTools.js">
    	//<![CDATA[
    	<!--
    	FacebookSetup('CABLED Project first 6 months', 'images/angela-imiev.jpg');
    	//-->
    	//]]>
    </script>
    Thanks

  • #2
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    380
    Thanks
    9
    Thanked 39 Times in 39 Posts
    I suspect you will need to import the external script separately from the call to the function.
    Code:
    <script type="text/javascript" src="SiteTools.js"></script>
    <script type="text/javascript">
    	//<![CDATA[
    	<!--
    	FacebookSetup('CABLED Project first 6 months', 'images/angela-imiev.jpg');
    	//-->
    	//]]>
    </script>
    Also, I'm not entirely sure you need the CDATA stuff either. That's for really old browsers which few people use these days.
    Regards, Stooshie
    O

  • #3
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for your prompt response.

    I have copied the code and it now passes the validation.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •