Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 04-03-2006, 08:45 PM   #1
Solid State Member
 
Join Date: Jan 2006
Posts: 8
Thumbs up creating date function with javascript

(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
__________________

Trez is offline   Reply With Quote
Old 04-03-2006, 08:48 PM   #2
BSOD
 
Join Date: Apr 2006
Posts: 7
Default Re: creating date function with javascript

I think what you want is just a date-function script?

http://www.w3schools.com/jsref/tryit...=tryjsref_date
__________________

Intel-Fanboy is offline   Reply With Quote
Old 04-04-2006, 08:48 AM   #3
Solid State Member
 
Join Date: Jan 2006
Posts: 8
Default Re: creating date function with javascript

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?
Trez is offline   Reply With Quote
Old 04-04-2006, 08:57 AM   #4
Solid State Member
 
Join Date: Jan 2006
Posts: 8
Default Re: creating date function with javascript

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
Trez is offline   Reply With Quote
Old 04-06-2006, 02:42 AM   #5
Solid State Member
 
Join Date: Jan 2006
Posts: 8
Thumbs up Re: creating date function with javascript

Trez is offline   Reply With Quote
Old 04-12-2006, 04:29 AM   #6
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: creating date function with javascript

<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>
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 05:15 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0