Jump to content

putting function to this block...


desjardins2010

Recommended Posts

Guys/Gals;

 

This below block outputs a very simple progress bar, i'm curious if anyone would see a solution to perform a task when this bar reaches the end as you can see it's set to countinue until width<400 when that 400 is true I and in essence the process is done (even though nothing in reality) i want to display countinue but only when it's done

 

echo "<table width='100%' border='1' cellpadding='1' cellspacing='1' bgcolor='#666666'><tr><td width='506' height='52' valign='top'><script type='text/javascript'>function progress(){if(document.images['bar'].width<400){document.images['bar'].width+=5;document.images['bar'].height=5; 
   }else{clearInterval(ID);}}var ID;window.onload=function(){ID=setInterval('progress();',$cpuspeed);}</script><img src='images/white.gif' name='bar'/><br /><font color='#ffffff'>Cracking....</font></td></tr></table>";

any dideas

Link to comment
Share on other sites

the problem is an issue of server-side vs client-side scripts.

 

the variable $cpuspeed that you're outputting is sent from the server side to the user's browser where javascript (a client-side script) uses it in its function.

 

Once the the serverside has sent its variable to the browser, thats the end of it.  Unless you're doing some tricky AJAX stuff where the browsers constantly talkes to the server, what you're trying to implement just won't work.

Link to comment
Share on other sites

thanks guys for your input, heres the thing the progress bar is completly fake it's not calculating anything, simply in a game I'm making I want the progress bar when finished to forward to another page acting as if it just did something... the $cpuspeed varible you see is why I like this little progression bar cause I can have it move faster for users with higher cpuspeed.. just can't get a redirect when this progress bar is full?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.