View Full Version : Ajax Rotating Includes Script

12-12-2005, 07:59 PM
Ajax Rotating Includes Script (http://www.dynamicdrive.com/dynamicindex17/ajaxrotate.htm) appears to have an omission in its coding. The demo page lays out a means by which multiple rotating includes may appear on one page. However, if the instructions are followed and one of the defined file arrays is:

var includefiles=

as more or less suggested, that is the only array that will be used for any and all rotating includes on that page. It may even be so bad as - if that array is not present, there will be no defined files. I don't know about that bit, I haven't tested it. If the ajaxinclude function is added to (addition red):

function ajaxinclude(files_array, rotatetype){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try { . . .

This takes care of the problem. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6523).

12-13-2005, 12:32 AM
Ah yes thanks for pointing this out (not to mention help out the poor chap). The real problem basically starts at:

function ajaxinclude(files_array, rotatetype){
var url=choosefile(files_array, rotatetype)
if (typeof includefiles[url]=="undefined"){

For the part in red and a few lines following it, I accessed the array
itself instead of the reference to it: files_array, harding coding things.

I'll get to fixing this later today or tomorrow. Thanks again,