Name: Anonymous 2007-06-05 2:06 ID:PuWpo3KP
◑ ◔
╔═╗
║▓▒░░░░░░░░░░░░░░░░░
╚═╝
Now then, I'm using AHAH to implement a dynamic interface, but I'm having trouble with multiple AHAH calls and queuing them.
while( targetQueue.length > 0 )
{
url = queue[ 0 ];
target = targetQueue[ 0 ];
if( window.XMLHttpRequest )
{
req = new XMLHttpRequest();
req.onreadystatechange = function() {ahahDone(target);};
req.open("GET", url, true);
req.send(null);
}else if( window.ActiveXObject )
{
req = new ActiveXObject("Microsoft.XMLHTTP");
if( req )
{
req.onreadystatechange = function() {ahahDone(target);};
req.open("GET", url, true);
req.send();
}
}
if( queue.length > 1 )
queue.shift();
targetQueue.shift();
}
queue and targetQueue are arrays of urls and HTML DIV IDs, respectively, and in this particular case targetQueue.length > queue.length so I'm trying to load the same page into multiple DIVs, but instead only the last DIV gets it's innerHTML set while the others remain the same. Example onClick code:
<input type='button' value='Loading 1 source URL into two targets' onClick="javascript:queue[ queue.length ] = 'chat.php';targetQueue[ targetQueue.length ] = 'targetDiv';targetQueue[ targetQueue.length ] = 'targetDiv2';ahah( queue, targetQueue );">
╔═╗
║▓▒░░░░░░░░░░░░░░░░░
╚═╝
Now then, I'm using AHAH to implement a dynamic interface, but I'm having trouble with multiple AHAH calls and queuing them.
while( targetQueue.length > 0 )
{
url = queue[ 0 ];
target = targetQueue[ 0 ];
if( window.XMLHttpRequest )
{
req = new XMLHttpRequest();
req.onreadystatechange = function() {ahahDone(target);};
req.open("GET", url, true);
req.send(null);
}else if( window.ActiveXObject )
{
req = new ActiveXObject("Microsoft.XMLHTTP");
if( req )
{
req.onreadystatechange = function() {ahahDone(target);};
req.open("GET", url, true);
req.send();
}
}
if( queue.length > 1 )
queue.shift();
targetQueue.shift();
}
queue and targetQueue are arrays of urls and HTML DIV IDs, respectively, and in this particular case targetQueue.length > queue.length so I'm trying to load the same page into multiple DIVs, but instead only the last DIV gets it's innerHTML set while the others remain the same. Example onClick code:
<input type='button' value='Loading 1 source URL into two targets' onClick="javascript:queue[ queue.length ] = 'chat.php';targetQueue[ targetQueue.length ] = 'targetDiv';targetQueue[ targetQueue.length ] = 'targetDiv2';ahah( queue, targetQueue );">