First let's take a look at the
This method is good for small to medium sized programs, that are only to be included in a single webpage. For that script tags are used:
This script should throw an error like "document.getElementById("test") is null". Put the script tag after the div tag and the program runs fine.
Another way to prevent the PCDATA issue in XHTML is to use
See this example in action:
Examples for such attributes are (they are pretty self-explanatory): onchange, onmouseover, onclick, ondblclick, onkeydown, onkeypress, onkeyup, onload, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onunload