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> Link to comment https://forums.phpfreaks.com/topic/91688-php-and-js/ 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 Link to comment https://forums.phpfreaks.com/topic/91688-php-and-js/#findComment-469565 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 Link to comment https://forums.phpfreaks.com/topic/91688-php-and-js/#findComment-469566 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 Link to comment https://forums.phpfreaks.com/topic/91688-php-and-js/#findComment-469571 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 Link to comment https://forums.phpfreaks.com/topic/91688-php-and-js/#findComment-469576 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.