Web Development and Design Foundations with XHTML, 5th Edition

(Steven Felgate) #1

(^582) Appendix A XHTML Reference
An example follows:



When strict XML syntax is applied, any JavaScript statements should be surrounded by
character data (CDATA) statements. This tells the XML parser to ignore the JavaScript
statements as arbitrary character data and not to process them. The syntax is as
follows:

Unfortunately, this generates a JavaScript error in many current browsers; therefore, it’s
not commonly used. This problem can be circumvented by accessing external JavaScript
files, as shown here:

In this case all the JavaScript statements are located in the external file called script.js
and no CDATA statement is needed.
The
The