code breaks as soon as I link jquery
If I insert
[code]<script src="http://code.jquery.com/jquery-1.7.2.min.js"/>[/code]
Above of
[code]
<script type="text/javascript" >
function processxml(xmldoc) {
var i, root, el, els, str, esc;
i = 0;
root = xmldoc.getElementsByTagName("featurelist")[0];
el = root.getElementsByTagName("chapter")[0];
/* Initiate contents */
str = '<ul id="contents">';
while(el && el != root) {
if(c=el.getAttributeNode("htmlclass"))
str += '<div id="' + c.value + '">';
str += "<li>" + el.getAttribute("title") +"</li>";
if((els = el.getElementsByTagName("chapter")).length) {
str += "<ul>";
el = els[0];
continue;
}
esc = 0;
while(!esc) {
save = el;
while((el = el.nextSibling) && el.nodeName != "chapter")
;
if(!el) {
/* No next sibling */
str += "</ul>";
el = save;
while((el = el.parentNode) && el.nodeName != "chapter")
;
if(!el)
/* No parent */
break;
else
/* Found parent, look again for sibling */
continue;
}
else {
/* We have next sibling */
if(c)
str += "</div>";
esc = 1;
}
}
}
/* Terminate contents */
str += "</ul>";
alert(str);
// document.write(str);
document.body.innerHTML = str;
}
function init() {
var xml;
xml = new XMLHttpRequest();
xml.open("GET", "digest.xml", false); // Will make asynchronous later on.
xml.send();
xmldoc=xml.responseXML;
processxml(xmldoc);
}
</script>
[/code]
The page fails to load with a "init is not defined" error. It loads just fine if I don't link the jquery source.