Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check is the frame loaded

    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

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    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

  • #3
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Or something like this:
    Code:
    <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.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #4
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is for bux script if you know this type of scripts.This is the part which is crediting the user

    PHP Code:
    <?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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •