Lost Password?

  #1 (permalink)  
Old 12-02-2006, 08:22 AM
TcM's Avatar   
TcM TcM is offline
Code Slinger.. FTW!
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 6,443
Rep Power: 60
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
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 your post count must be 1 or greater. Your post count is 0 momentarily.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help

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

Sponsored Links
  #2 (permalink)  
Old 01-01-2007, 10:03 AM
xtraze xtraze is offline
Programming God
 
Join Date: Dec 2006
Location: Sri lanka
Posts: 921
Rep Power: 0
xtraze is on a distinguished road
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
AfTriX AfTriX is offline
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 596
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 Slinger.. FTW!
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 6,443
Rep Power: 60
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
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!
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
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
AfTriX AfTriX is offline
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 596
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

Sponsored Links
  #6 (permalink)  
Old 01-03-2007, 07:44 AM
TcM's Avatar   
TcM TcM is offline
Code Slinger.. FTW!
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 6,443
Rep Power: 60
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Default

Quote:
Originally Posted by AfTriX View Post
Seems Tcm9669 continuously digging on JavaScript mats. Nice work and thanks
Welcome
I just like JavaScript
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
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
AfTriX AfTriX is offline
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 596
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
xtraze xtraze is offline
Programming God
 
Join Date: Dec 2006
Location: Sri lanka
Posts: 921
Rep Power: 0
xtraze is on a distinguished road
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
AfTriX AfTriX is offline
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 596
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
doosa doosa is offline
Newbie
 
Join Date: Mar 2008
Posts: 1
Rep Power: 0
doosa is on a distinguished road
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

Sponsored Links
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
Javascript: Analog Clock TcM Javascript 20 05-28-2008 09:01 AM
Creating an analog clock with ActionScript AfTriX Tutorials, Classes and Code 2 01-07-2007 02:19 AM
Creating a Clock AfTriX VB Tutorials 0 01-04-2007 01:53 AM
Cool LCD Clock AfTriX Javascript 2 01-04-2007 01:00 AM


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

Contest Stats

Xav ........ 164.00000
dargueta ........ 128.00000
John ........ 127.00000
gaylo565 ........ 18.00000
XaNaX ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

Ads