|
||||||
| Javascript Javascript Tutorials and Code |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
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>
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> 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!!
__________________
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. |
| Sponsored Links |
|
|
|
|||||
|
Quote:
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 |
|
|||||
|
Quote:
![]() 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 |
|
|||
|
Don NOT forget to inform all the CodeCall members to tell about your site once its completed
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 |