blogscrubber Posted June 3, 2008 Share Posted June 3, 2008 I have been working on this the past two days and the code below works without the +type+id... I need to get the timer working with +type+id or it is useless to me! PLEASE PLEASE HELP! function getTime(min, sec, type, id) { var min = document.getElementById("editTimeminutes"+type+id).innerHTML; var sec = document.getElementById("editTimeseconds"+type+id).innerHTML; var minfield = "editTimeminutes"+type+id; var secfield = "editTimeseconds"+type+id; // function display() { sec--; if (sec == -01) { sec = 59; min = min - 1; } else { min = min; } if (sec<=9) { sec = "0" + sec; } minutes = min<=9 ? "" + min : min; seconds = sec; document.getElementById(minfield).innerHTML = minutes; document.getElementById(secfield).innerHTML = seconds; // } if (min == '0' && sec == '00') { sec = "00"; window.clearTimeout(SD); document.getElementById("editTimeminutes"+type+id).style.display = 'none'; document.getElementById("editTimeseconds"+type+id).style.display = 'none'; document.getElementById("mintxt"+type+id).style.display = 'none'; document.getElementById("sectxt"+type+id).style.display = 'none'; } SD=window.setTimeout("getTime();", 1000); // display(); } below are the fields and script to execute this function <table width="100%"> <tr><td width="100%" align="center"> <span id="editTimeminutes12" class="timeClass" style="display:visible;">4</span> <span id="mintxt12">min</span> <span id="editTimeseconds12" class="timeClass" style="display:visible;">12</span> <span id="sectxt12">sec left to edit</span> <br/><br/> <span id="testValues"></span> </td></tr> </table> <script language="javascript"> getTime(4,12,1,2) </script> <table width="100%"> <tr><td width="100%" align="center"> <span id="editTimeminutes13" class="timeClass" style="display:visible;">2</span> <span id="mintxt13">min</span> <span id="editTimeseconds13" class="timeClass" style="display:visible;">31</span> <span id="sectxt13">sec left to edit</span> <br/><br/> <span id="testValues"></span> </td></tr> </table> <script language="javascript"> getTime(2,31,1,3) </script> Quote Link to comment Share on other sites More sharing options...
hansford Posted June 6, 2008 Share Posted June 6, 2008 show us the values your passing for arguments type & id. Heck show us all the values you're passing. 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.