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
https://forums.phpfreaks.com/topic/222415-putting-function-to-this-block/
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.

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.