Pofski Posted April 17, 2014 Share Posted April 17, 2014 Hi, i was wondering if anybody could help me out with the following problem. I have a counter that counts up from a certain date. the counter date is the date of any type of incident at the company where i work. Whenever something happens, i change the date in the script, but i was wondering if there would be a more user friendly way of doing this. What i am trying to do is integrate a datafield where certain users, depending on their user id, could enter a new date in case something happens, and this would change the date in the script. Thank you in advance for your help. <head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><title>Untitled 1</title> <script>window.onload=function(){var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") var myDate=new Date(); function countUp(yr, mo, da){ var today=new Date() var todayy=today.getYear() if (todayy < 1000) todayy+=1900 var todaym=today.getMonth() var todayd=today.getDate() var todayh=today.getHours() var todaymin=today.getMinutes() var todaysec=today.getSeconds() var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec paststring=montharray[mo-1]+" "+da+", "+yr dd=Date.parse(todaystring)-Date.parse(paststring) dday=Math.floor(dd/(60*60*1000*24)*1) dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1) dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1) dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1) return (dday + " days, " + dhour + " hours, " + dmin + "mins, " + dsec + " seconds");} function drawCountUp(){ var tdOne = document.getElementById("one"); tdOne.innerHTML = countUp(2012, 9, 19); var tdTwo = document.getElementById("two"); tdTwo.innerHTML = countUp(2012, 8, 19); var tdThree = document.getElementById("three"); tdThree.innerHTML = countUp(2012,7, 19);}drawCountUp(); setInterval(drawCountUp,1000);}</script> </head> <body> <table><tr><td>One</td><td id='one'></td></tr><tr><td>Two</td><td id='two'></td></tr><tr><td>Three</td><td id='three'></td></tr> </table> <input datafld="first" name="one" size="35" type="text" /><button onclick="myFunction{}">input date</button> </body> Link to comment Share on other sites More sharing options...
es131245 Posted April 17, 2014 Share Posted April 17, 2014 (edited) I'm editing my web pages using php. All you need is read/write permissions to editable files for web server user and editor script. Edited April 17, 2014 by es131245 Link to comment Share on other sites More sharing options...
Pofski Posted April 17, 2014 Author Share Posted April 17, 2014 The problem is that we can not use php in our work environment because the company does not want to allow it on the servers :/ Link to comment Share on other sites More sharing options...
es131245 Posted April 17, 2014 Share Posted April 17, 2014 (edited) You will need any language to do this. It could be any of php, asp, cgi. Edited April 17, 2014 by es131245 Link to comment Share on other sites More sharing options...
davej Posted April 17, 2014 Share Posted April 17, 2014 You can't accomplish this with client-side Javascript. As described above you need server-side code or FTP. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now