Guest lenix Posted February 22, 2013 Share Posted February 22, 2013 I need some help in my code. All I want is after my timer reaches to zero it will automatically triggered the submit button. My JSCode: <input id='timer' readonly> <script> var ct = setInterval('calculate_time()',100); function calculate_time() { var end_time = '$_SESSION[start_time]'; var dt = new Date(); var time_stamp = dt.getTime()/1000; var total_time = end_time - Math.round(time_stamp); var mins = Math.floor(total_time / 60); var secs = total_time - (mins * 60); if(secs < 10){secs = '0' + secs;} document.getElementById('timer').value = mins + ':' + secs; if(mins <= 0) { if(secs <= 0 || mins < 0) { clearInterval(ct); document.getElementById('timer').value = '00:00'; alert('TIME IS UP! To continue you should press OK Button'); document.location("PROCESS.PHP") ;<-----------------------ITS NOT WORKING!!! } } } </script> Link to comment https://forums.phpfreaks.com/topic/274810-using-javascript-to-automatically-triggered-the-submit-button-when-the-time-limit-is-over/ Share on other sites More sharing options...
denno020 Posted February 23, 2013 Share Posted February 23, 2013 try window.location Denno Link to comment https://forums.phpfreaks.com/topic/274810-using-javascript-to-automatically-triggered-the-submit-button-when-the-time-limit-is-over/#findComment-1414338 Share on other sites More sharing options...
Guest lenix Posted February 26, 2013 Share Posted February 26, 2013 Tnx for the help denno020. I have already solved my problem with this code : document.myform.submit(); - - -- -- - > my problem relies on the submission process (from $_POST(Button_name){} to $_POST only . . this problem was solved. Once again thank you so much for the help. 143 ALL. . Link to comment https://forums.phpfreaks.com/topic/274810-using-javascript-to-automatically-triggered-the-submit-button-when-the-time-limit-is-over/#findComment-1415040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.