3) Describe problem: The Ajax Includes (http://www.dynamicdrive.com/dynamicindex17/ajaxincludes.htm) Script uses document.write(xmlhttp.responseText) (or something similar). What's the most elegant way of converting that to modern DOM-coding?
Rangana, thanks, but I don't want to use innerHTML and document.write.
but I didn't want to use innerHTML from the start.
So I'm looking now for a method to replace document.write(document.getElementById('nodeVal').firstChild.nodeValue); with something that doesn't use inner and write.
The existing AJAX script, which you are talking about is designed in such a manner that the AJAX call will be made before completely loading the page in which you've integrated this script.
I've highlighted the changes I've made.
your_DOM_Constructor_Method(); //You don't have to pass the XHR object as it is a global one and will be accessible inside your method.
Here is some good articles about the technique using which you can construct the fully DOM based structure, this articles explains the technique in a step by step manner and can be followed very easily. You can find other good articles about this one.
Codeexploiter, thanks. I'll give that a try.