...

View Full Version : time AND date in a textbox? Help me please!



ultrapasty
06-16-2003, 09:04 PM
Hi
I'm new to javascript and I need this particular script, but don't know how to make it work!
I need the date followed by the time (which changes, eg not static) in a textbox in a form named 'chat', but I can't make it work.

Can anyone help me? Or does anyone know any tuts for this or free scripts?

Thanks!
PS: Please dont use any complicated words! And remember - i'm a dummy at this.............

beetle
06-16-2003, 11:27 PM
Something like this? I can modify it so that it puts the time into a form...

http://www.peterbailey.net/dhtml/datestamp.htm

Skyzyx
06-17-2003, 10:26 AM
Same here. I can slim down the code to be more specific to your needs, and have it display in a form.

Clock script documentation (http://host44.ipowerweb.com/~skyzyxco/scripts/clock.htm)
Date script documentation (http://host44.ipowerweb.com/~skyzyxco/scripts/date.htm)
The timedate.js file they both use (http://host44.ipowerweb.com/~skyzyxco/wpi/timedate.js)

Let me know. :)

ultrapasty
06-17-2003, 07:03 PM
Originally posted by beetle
Something like this? I can modify it so that it puts the time into a form...

http://www.peterbailey.net/dhtml/datestamp.htm

That 3rd one is brilliant, perfect for what i want! If you would, could you make it so that the 3rd one is in a textbox? I only want the 3rd, the others are too long!

That would be great :D

beetle
06-17-2003, 07:37 PM
Sure



<html>
<head>
<title>Date Stamp</title>
<script type="text/javascript" src="http://www.peterbailey.net/dhtml/js/date.class.js"></script>
<script type="text/javascript">

function init()
{
var d = new DateStamp( document.forms[0].elements['Date'], 'm/d/y G:i:s a', 1000 );
}

function DateStamp( elem, dateFormat, interval )
{
var self = this;
this.elem = elem;
this.format = dateFormat;
this.update = function()
{
this.elem.value = new MyDate().getDate( this.format );
}
this.update();
this.interval = setInterval( function() { self.update() }, interval )
}

</script>
</head>

<body onload="init()">
<form id="someForm">
<input type="text" name="Date" readonly="true" />
</form>
</html>
Just make sure you download the Date class (http://www.peterbailey.net/dhtml/js/date.class.js)

ultrapasty
06-17-2003, 07:46 PM
Fantastic! Thanks a lot!
:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum