Loriot Posted August 11, 2006 Share Posted August 11, 2006 Hi all,I need some help with that. I am trying to get the date & time as a default value into a form.I tried a lot of variations with and without header functions like for example <input type="text" name="Time" value="?[$document.write(Date())]" /> How do I get this?? Thanx for any help you can give.\Loriot Link to comment Share on other sites More sharing options...
Golanlan Posted August 11, 2006 Share Posted August 11, 2006 <html><body><script type="text/javascript">var d = new Date()var hours = d.getHours()var minutes = d.getMinutes()if (minutes<=9){document.write("<form>")document.write("<input type='text' name='time' value=hours + ':0' + minutes>")}else{document.write("<form>")document.write("<input type='text' name='time' value=(hours + ':' + minutes)>")}</script></form></body></html> It isn't working so well, shows "Hours" in the text-field. Link to comment Share on other sites More sharing options...
Golanlan Posted August 16, 2006 Share Posted August 16, 2006 nobody can help here? Link to comment Share on other sites More sharing options...
aspnetguy Posted August 16, 2006 Share Posted August 16, 2006 do this <html><body><script type="text/javascript">var d = new Date()var hours = d.getHours()var minutes = d.getMinutes()document.write('<form>')if (minutes<=9) document.write('<input type="text" name="time" value="' + hours + ':0' + minutes + '">')else document.write('<input type="text" name="time" value="' + hours + ':' + minutes + '">')document.write('</form>')</script></body></html> Link to comment Share on other sites More sharing options...
Loriot Posted August 18, 2006 Author Share Posted August 18, 2006 Thanks a lot! That worked. 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