creating date function with javascript

Trez

Solid State Member
Messages
8
(For college).I've searched all over google, there are alot of different examples, but not exactly what i'm looking for, if anyone could help that would be great :)

I've created a form, has many other javascript functions, all i have to do now is to create this date function. It has to be displayed in a text box (which I have allready created), and the user should not be able to change the value (i know how to do this). The date must be displayed in the format of dd/mm/yyyy. If anyone knows how to do this, or a url explaining it that would be great, thanks for your help :)
 
I had a look at that, but would it be possible to get that in the format of dd/mm/yyyy and also in a text box, not as a document.write?
 
I now have the function..

<!--
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
document.write(month + "/" + day + "/" + year)
//-->

Now just to write it in the input box. I guess it has something to do with the "value" of the input box, but not sure how to call it in
 
<script>
function date_function() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var fulldate = month + "/" + day + "/" + year
document.formname.inputbox.value=fulldate
}
</script>

<body onload="date_function();">
<form name="formname">
<input type="text" name="inputbox">

</form>
</body>
 
Back
Top Bottom