Click to See Complete Forum and Search --> : [RESOLVED] Converting old page to XHTML, and JavaScript dies


AmazingAnt
11-01-2006, 10:02 AM
I have this calender I'm working with, and I'm trying to convert it to XHTML. This is proving to be a long and boring process, but I'm still working on it.

It seems to be going ok so far, except that when I add the XHTML 1.0 Strict Doc type to the top, the JavaScript stops working.

It's a very long bit of code, so I saved it as a txt file and attached it.
Since I'm using FF, I just opened up the Error Console and tryed to fix the problems using that, but I'm getting confused by how to fix some of the problems. In addition, I'm still unaware as to why it's not showing anything when the Doc type is there. Ideas anyone?

Kor
11-01-2006, 10:13 AM
XML will read literally some javascript operators or characters (< > &) as being it's own code markups, thus you have to escape the code inside a CDATA section:

<script type="text/javascript">
/* <![CDATA[ */
......... your code here .........
/* ]]> */
</script>


You may also put the code in an external js file

<script type="text/javascript" src="myscript.js"></script>

AmazingAnt
11-01-2006, 10:16 AM
XML will read literally some javascript operators or characters (< > ....), thus you have to escape the code:

<script type="text/javascript">
/* <![CDATA[ */
......... your code here .........
/* ]]> */
</script>


You may also put the code in an external js file

<script type="text/javascript" src="myscript.js"></script>

Using an external .js file is a very good thing indeed, but until I get the whole thing finished, I'm going to use the first method. Thanks for both!~