PDA

View Full Version : Ajax Includes Script I



molendijk
08-19-2008, 05:34 PM
1) CODE TITLE: Ajax-includes: combining document.write and innerHTML

2) AUTHOR NAME/NOTES: Arie Molendijk

3) DESCRIPTION: Using document.write for the Ajax-responseText automatically brings all of the external css and js to the main file (with innerHTML, that cannot be achieved). The disadvantage of the document.write-method, however, is that it does not allow dynamically updating the page.
The script offered here proposes a solution, by combining document.write and innerHTML.
Inspired by DD's Ajax Includes Script (http://www.dynamicdrive.com/dynamicindex17/ajaxincludes.htm).

4) URL TO CODE: http://molendijk.110mb.com/include_with_write_and_inner/ajaxinclude_with_write_and_inner.html

Nile
08-19-2008, 05:39 PM
I say turn it into ajax tabs. That'd be good.

molendijk
08-19-2008, 05:52 PM
Nile, that would be a possibility.
But when I wrote the script, I was primarily interested in the question how static document.write can be 'made like' dynamic innerHTML.
Note that DD's Ajax-tabs use innerHTML only. So the Ajax-tabs script does not automatically bring external js/css to the main file. My script does.
===
Arie.

Nile
08-19-2008, 05:59 PM
There is a version of the ajax tabs that does get external files though. Just make tabs too, for an example of what it would look like for people, and if they wanted to use tabs, they could.

molendijk
08-19-2008, 06:09 PM
There is a version of the ajax tabs that does get external files though.
I was not talking about external files (every Ajax-script can include external files), but of the css/js belonging to them. My script automatically brings them to the main file, without forcing you to 'name' them in the ajax-script.
===
Arie.