I need to load 6 iframes in page A.php. the contents of these 6 iframes are 6 sub pages: a1.php~a6.php. before each sub page is loaded, i need to do a ajax first (to change the database) and then load the sub pages. here is the problem. each sub page should be loaded one by one. that is to say, a2.php only can be loaded after a1.php is loaded. how to realize this function? because each sub page has a big size, so it needs a little bit long time to load. Every time, when a1.php isnot loaded totally, the ajax in a2.php is working (so the datatable has been changed).
Thank you very much if you can help me:)
JS:
function showpic(id,x,y)
{
if (id==0)
{
var oBao = CreateHTTPObject();
var url = "ajax.php";
var sendstring="x="+x;
oBao.open("POST",url,false);
oBao.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oBao.send(sendstring);
oBao.onreadystatechange = function () { OnReadyStateChng();};
document.getElementById("iframe"+id).src="a.php?y=" +y;
}
else
{
var iid=id-1;
document.getElementById("iframe"+iid).onload=function()
{
var oBao = CreateHTTPObject();
var url = "ajax.php";
var sendstring="x="+;
oBao.open("POST",url,false);
oBao.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oBao.send(sendstring);
oBao.onreadystatechange = function () { OnReadyStateChng();};
document.getElementById("iframe"+id).src="a.php?y=" +y;
}
}
}
PHP:
for($i=0;$i<2;$i++)
{
for($j=0;$j<3;$j++)
{
$nu=$i*3+$j;
$div="iframe".$nu;
echo "<iframe id='$div' height='400px' frameborder=0 ></iframe>";
echo "<script language='JavaScript'>showpic($nu,$x,$y) ;</script></div>";
}
}