...

View Full Version : Check is the frame loaded



mantodeus
08-02-2008, 12:28 PM
Hello

First I am glad that I found this forum where I can try to receive little help for my projects.You have really nice community and I am happy that I find you.

I have one little problem - I have two frames.I want second frame to be loaded first and the frame at the top of the page to be loaded only if second frame finished the loading.I know that sounds little crazy :) I don't want to use preload on the server because.

Do you know way to do this ? I will be very grateful if you can help me.Thank you for the attention.

Best Regards

ess
08-02-2008, 01:24 PM
Use JavaScript to do this.

On the frame that you want to load first, add an onload event which calls a function that adds the source for the second frame...therefore loading its contents

Cheers
~E

rangana
08-02-2008, 01:28 PM
Or something like this:


<script type="text/javascript">
window.onload=function(){
alert('Done loading on the first frame. Prepare for the next frame'); // Just to see if it really works.
for(var i=0,iframe=document.getElementsByTagName('iframe');i<iframe.length;i++){
iframe[i].style.display='';}}
</script>
<iframe src="http://www.fashionstyleblog.com" style="border:0px;width:100&#37;;height:300px;"></iframe><iframe src="http://www.codingforums.com" style="border:0px;width:100%;height:300px;display:none;"></iframe>

P.S. I called a page which I'm certain is slow to load.

mantodeus
08-02-2008, 01:37 PM
This is for bux script if you know this type of scripts.This is the part which is crediting the user


<?php } ?>
var y = 1;
function startClock() {
if (x !== 'Done') {
x = x-y;
document.frm.clock.value = x;
setTimeout("startClock()", 1000);

}
if (x == 0) {
x = 'Done';
document.frm.clock.value = x;
var code = "<?php
if($loggedin==1)
{
$site_code = md5(time().sha1(microtime()));
} else {
$site_code = "Not Login";
}
$_SESSION["adcode"] = $site_code;
print($site_code);

?>";
var ad= "<?=$_GET['ad']?>";
success.location.href="success.php?ad="+ad+"&code="+code+"&verify=1";
}
}
</script>

</head>
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" onLoad="startClock()">
<form name="frm">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="maintopright" style=" background:url(images/adloading.gif) no-repeat 150px;border-bottom: 2px solid rgb(51, 51, 51); font-family: Verdana; font-size: 13px;" width="50%">
<div class="maintopright">&nbsp;&nbsp;<img src="images/top_small.jpg" align="middle" />&nbsp;&nbsp;&nbsp;&nbsp;
<input name="clock" size="3" readonly="readonly" style="border: medium none ; padding: 0pt; font-size: 25pt; font-family: Verdana; vertical-align: top;" type="text">
<iframe name="success" src="view.php?example" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" style="vertical-align: top;" frameborder="0" height="48" scrolling="no" width="48"></iframe>
</div>
</td>
<td style="border-bottom: 2px solid rgb(51, 51, 51); font-family: Verdana; font-size: 13px; " align="left" valign="middle" width="50%">
<strong>Please take the time to visit the sponsor below.<br>
Show your website below for only <a href="index.php?option=advertise" target="_blank">$<?=$rowz1["price"]?></a> per 100 views!</strong>
</td>
</tr>
</tbody>
</table>
<iframe src="<?=$ad["ad_url"]?>" border="0" framspacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe>
</form>
</body>
</html>

As you see when user click on the ad clock is starting to count 30 secs,after 30 secs it is crediting the user but if the user hit esc key advertisement is not loaded but clock start the counting,I want to avoid this but it will be harder than I thought :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum