Hi there all,
I have this following code which is on a timer, here it is:
Which I have tried to replace the "20 seconds with a php string called "<?=TIME_LIMIT?> which equals to 20, this is what I did:Code:<script type="text/javascript"> for(var i=0;i<20;i++) setTimeout("foo('"+i+"')",(20-i)*2000); function foo(n){ document.getElementById('btn').value=n; if(n==0){ document.getElementById('btn').value='Download Now!'; document.getElementById('btn').disabled=false; } } </script>
But it didn't workCode:<script type="text/javascript"> for(var i=0;i<<?=TIME_LIMIT?>;i++) setTimeout("foo('"+i+"')",(<?=TIME_LIMIT?>-i)*<?=TIME_LIMIT?>00); function foo(n){ document.getElementById('btn').value=n; if(n==0){ document.getElementById('btn').value='Download Now!'; document.getElementById('btn').disabled=false; } } </script>. Howcome? Is it because you cant use PHP Strings in JavaScripts? Thanks very much for your help and support
Best Regards,
Private_Guy



. Howcome? Is it because you cant use PHP Strings in JavaScripts? Thanks very much for your help and support 
Reply With Quote


Bookmarks