Connect with Facebook Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Tutorials > Javascript

Javascript Javascript Tutorials and Code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-02-2006, 08:22 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Posts: 9,814
Blog Entries: 6
Rep Power: 82
TcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to all
Default JavaScript:Tutorial, Digital Clock

Introduction:-
This is my second tutorial and I will show you how to get the Time in a Text Box.. perhaps in a Text Box it will be useless, but it could be used in other instances!

Solution:-
This code goes in the <head> tags:-

Code:
<script language="JavaScript">

var timerID = null;
var timerRunning = false;

function stopclock (){
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
}

function showtime () {
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds()
        var timeValue = hours
        timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds
        document.clock.face.value = timeValue;
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
}
function startclock () {
        stopclock();
        showtime();
}

</script>
And this code as the body code:-

Code:
<body onLoad="startclock()">

<form name="clock" onSubmit="0">
  <div align="center"><center><p><input type="text" name="face" size="10" value> </p>
  </center></div>
</form>
Explanation:-
I think its simple without any need of explanation.. but if you have any suggestions/questions just post them here

A Preview:-


Conclusion:-
As Always Feedback is welcome and the full source is attached!!
Attached Files To view attachments in this forum your post count must be 1 or greater. You currently have 0 posts.

Last edited by Jaan; 03-09-2008 at 10:09 AM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-01-2007, 10:03 AM
Programming God
 
Join Date: Dec 2006
Location: Sri lanka
Posts: 908
Rep Power: 0
xtraze is an unknown quantity at this point
Send a message via MSN to xtraze Send a message via Skype™ to xtraze
Default

Nice, and I am now looking for an Analog clock now. Hope I can find it by Google. I will search tomorrow.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-03-2007, 04:22 AM
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 586
Rep Power: 0
AfTriX is on a distinguished road
Default

Thanks for the code. very useful. Text Box clock idea is good, and pretty simple code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-03-2007, 06:40 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Posts: 9,814
Blog Entries: 6
Rep Power: 82
TcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to all
Default

Quote:
Originally Posted by xtraze View Post
Nice, and I am now looking for an Analog clock now. Hope I can find it by Google. I will search tomorrow.
Javascript: Analog Clock

I found this one for you!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-03-2007, 06:46 AM
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 586
Rep Power: 0
AfTriX is on a distinguished road
Default

Seems Tcm9669 continuously digging on JavaScript mats. Nice work and thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-03-2007, 07:44 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Posts: 9,814
Blog Entries: 6
Rep Power: 82
TcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to all
Default

Quote:
Originally Posted by AfTriX View Post
Seems Tcm9669 continuously digging on JavaScript mats. Nice work and thanks
Welcome
I just like JavaScript
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-04-2007, 12:05 AM
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 586
Rep Power: 0
AfTriX is on a distinguished road
Default

Quote:
Originally Posted by Tcm9669 View Post
Welcome
I just like JavaScript
Nice to here. Keep on improving your skills..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-06-2007, 09:42 PM
Programming God
 
Join Date: Dec 2006
Location: Sri lanka
Posts: 908
Rep Power: 0
xtraze is an unknown quantity at this point
Send a message via MSN to xtraze Send a message via Skype™ to xtraze
Default

Thanks for it lol. Nice I will add it as an html mod into a Joomla powered website I'm currently working on.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-07-2007, 02:24 AM
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 586
Rep Power: 0
AfTriX is on a distinguished road
Default

Quote:
Originally Posted by xtraze View Post
Thanks for it lol. Nice I will add it as an html mod into a Joomla powered website I'm currently working on.
Don NOT forget to inform all the CodeCall members to tell about your site once its completed
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 03-09-2008, 01:59 AM
Newbie
 
Join Date: Mar 2008
Posts: 1
Rep Power: 0
doosa is an unknown quantity at this point
Default Re: JavaScript:Tutorial, Digital Clock

good script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Clock AfTriX VB Tutorials 1 05-08-2009 10:33 AM
Javascript: Analog Clock TcM Javascript 20 05-28-2008 09:01 AM
Creating an analog clock with ActionScript AfTriX Tutorials 2 01-07-2007 02:19 AM
Cool LCD Clock AfTriX Javascript 2 01-04-2007 01:00 AM


All times are GMT -5. The time now is 08:22 PM.

Freelance Jobs

XML/XSL: Need code for Book with Chapers using XML
Create an XML file for a book of your creation, and a basic CSS file that will format it to display ...
Earn: $40.00


C++/C: Simple firework cue sequencer
What I require is a rework of a simple cue sequencer. I have a piece of hardware (an Arduino boar...
Earn: $50.00


HTML/XHTML: Menu Rework - ASCIIBin
I'm placing this in the HTML/XHTML section of the Freelance site but you are not limited to HTML. Wh...
Earn: $20.00



CodeCall Goal

Goal #1: 1,000 Blogs
Goal #2: 1,000 Wiki Pages
Goal #3: 300,000 Posts
Goal #4: 20,000 Threads
Done: 30%, 23%, 55%, 75%

Ads