Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    time AND date in a textbox? Help me please!

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

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Something like this? I can modify it so that it puts the time into a form...

    http://www.peterbailey.net/dhtml/datestamp.htm
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Date script documentation
    The timedate.js file they both use

    Let me know.

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #4
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sure

    Code:
    <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
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #6
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Fantastic! Thanks a lot!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •