alin19 Posted February 18, 2008 Share Posted February 18, 2008 i have this javascript code, what can i make that every time the javascript is executed a php script to be executed also? is that posible? <?php $x=0; ?> <html> <head> <title>JavaScript Clock Demo</title> </head> <body> <center> <p align="center"><br><br><b><font face="Verdana" color="#000080">JavaScript Clock Demo</font></b></p> <div id="js_clock"> <script language="javascript"> var y=1; function js_clock() { <?php echo "var clock_div = document.getElementById('js_clock')"; echo "clock_div.innerHTML = ' $x'; $x++; ?> setTimeout("js_clock()", 2000); } js_clock(); </script> </div> <p align="center"><font size="1" face="Arial">Powered by <a href="http://www.webmasters.com" target="_blank">Webmasters.com</a></font></p> </center> </body> </html> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 18, 2008 Share Posted February 18, 2008 Please explain your question better. Also, please edit your post to surround the code with tags Ken Quote Link to comment Share on other sites More sharing options...
uniflare Posted February 18, 2008 Share Posted February 18, 2008 this is a javascript question and not php, wrong forum. though to ease your pain personally i would use frames, and use javascript to redirect the frame every time. i suck with javascript so this may not work as you plan Quote Link to comment Share on other sites More sharing options...
alin19 Posted February 18, 2008 Author Share Posted February 18, 2008 i've modified my script; my question is how can i make a php code to be executed every time that javascript is executed Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 18, 2008 Share Posted February 18, 2008 You need to use AJAX techniques, since PHP runs on the server and Javascript on the client. Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.