Threesuns

Email the Instructor

Contact

All Semesters

Semesters

All Courses

Courses

Scripting (Online)

CSYS2033

3 credits

2011Spring

01.10.11 - 05.06.11

Scripting (Online)

CSYS2033

Online
12:00 AM - 12:00 AM

Validating a HTML Document Containing Script Tags

How To

Using CDATA Tags

Step 0

When using javascript in a XHTML or HTML5 document, you must enclose the javascript code within the script tags within a set of CDATA tags. The CDATA tags tell any program parsing the HTML code that the "data" inside the CDATA tags is just data and should not be parsed according to the regular HTML rules. This most often has to be done to get an otherwise valid HTML page to pass validation with the W3C's HTML validator at validator.w3.org.

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