for some reason my script seems to loose track of my var: her is the code:
function setvars() { var minutes = 1000 * 60; var hours = minutes * 60; var d1 = document.pirep.st.value; <-- if i echo this out it works fine var d2 = document.pirep.lt.value; <-- if i echo this out it work fine var e = Date.parse(d1); <-- this var returns NaN to the browser? var e1 = Date.parse(d2); <-- this var returns NaN to the browser also? var y = e/minutes; var y1 = e1/minutes; var final = y1-y; document.pirep.st.value = d1; document.pirep.lt.value = d2; document.pirep.th.value = final; }
i can't work out for the life of me why it isnt working?
Solved the problem for some reason javascript decided all of a sudden it didnt like the date in the format: 12-12-2007 so i added:
[code=php]$st = str_replace("-","/",$st);[/code]
so it converts $st into 12/12/2007 which javascript like better