4

I'm trying to make a page XHTML 1.0 Transitional compliant. One of the issues the Validator has with my code lies within the following line:

if (isNumeric(code) && code.length == 4) {

Error:

character "&" is the first character of a delimiter but occurred as data

Here's another problematic line:

aData = data.split("&&");

Again, the error is this:

character "&" is the first character of a delimiter but occurred as data

How do I fix this?

3 Answers 3

7

My guess is your javascript codes are not enclosed porperly.

Take a look here:
Properly Using CSS and JavaScript in XHTML Documents

Exceprt:

<script type="text/javascript">
  var i = 0;

  while (++i < 10)
  {
    // ...
  }
</script>

VS

<script type="text/javascript">
 //<![CDATA[
  var i = 0;

  while  (++i < 10)
  {
    // ...
  }
 //]]>
</script>
Sign up to request clarification or add additional context in comments.

Comments

4

Wrap it in CDATA:

<script type="text/javascript">
//<![CDATA[

Javascript here

//]]>
</script> 

Comments

1

Javascript code should be placed within a CDATA declaration in order to pass XHTML validation.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.