Lost Password?

  #1 (permalink)  
Old 01-03-2007, 06:37 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: Analog Clock

This is the code for an analog clock once I found! But yesterday I saw it on littlefranciscan website

Code:
<p>                     <script language="JavaScript">
                           
                           //Analog clock script- By Kurt (kurt.grigg@virgin.net)
                           //Script featured on Dynamic Drive
                           //Visit http://www.dynamicdrive.com for this script and more
                           
                           fCol='444444'; //face colour.
                           sCol='FF0000'; //seconds colour.
                           mCol='444444'; //minutes colour.
                           hCol='444444'; //hours colour.
                           
                           Ybase=40; //Clock height.
                           Xbase=40; //Clock width.
                           
                           
                           H='...';
                           H=H.split('');
                           M='....';
                           M=M.split('');
                           S='.....';
                           S=S.split('');
                           NS4=(document.layers);
                           NS6=(document.getElementById&&!document.all);
                           IE4=(document.all);
                           Ypos=0;
                           Xpos=0;
                           dots=12;
                           Split=360/dots;
                           if (NS6){
                           for (i=1; i < dots+1; i++){
                           document.write('<div id="n6Digits'+i+'" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial;font-size:10px;color:#'+fCol+';text-align:center;padding-top:10px">'+i+'</div>');
                           }
                           for (i=0; i < M.length; i++){
                           document.write('<div id="Ny'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+mCol+'"></div>');
                           }
                           for (i=0; i < H.length; i++){
                           document.write('<div id="Nz'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+hCol+'"></div>');
                           }
                           for (i=0; i < S.length; i++){
                           document.write('<div id="Nx'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+sCol+'"></div>');
                           }
                           }
                           if (NS4){
                           dgts='1 2 3 4 5 6 7 8 9 10 11 12';
                           dgts=dgts.split(' ')
                           for (i=0; i < dots; i++){
                           document.write('<layer name=nsDigits'+i+' top=0 left=0 height=30 width=30><center><font face=Arial size=1 color='+fCol+'>'+dgts[i]+'</font></center></layer>');
                           }
                           for (i=0; i < M.length; i++){
                           document.write('<layer name=ny'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');
                           }
                           for (i=0; i < H.length; i++){
                           document.write('<layer name=nz'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');
                           }
                           for (i=0; i < S.length; i++){
                           document.write('<layer name=nx'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');
                           }
                           }
                           if (IE4){
                           document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
                           for (i=1; i < dots+1; i++){
                           document.write('<div id="ieDigits" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial;font-size:10px;color:'+fCol+';text-align:center;padding-top:10px">'+i+'</div>');
                           }
                           document.write('</div></div>')
                           document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
                           for (i=0; i < M.length; i++){
                           document.write('<div id=y style="position:absolute;width:2px;height:2px;font-size:2px;background:'+mCol+'"></div>');
                           }
                           document.write('</div></div>')
                           document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
                           for (i=0; i < H.length; i++){
                           document.write('<div id=z style="position:absolute;width:2px;height:2px;font-size:2px;background:'+hCol+'"></div>');
                           }
                           document.write('</div></div>')
                           document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
                           for (i=0; i < S.length; i++){
                           document.write('<div id=x style="position:absolute;width:2px;height:2px;font-size:2px;background:'+sCol+'"></div>');
                           }
                           document.write('</div></div>')
                           }
                           
                           
                           
                           function clock(){
                           time = new Date ();
                           secs = time.getSeconds();
                           sec = -1.57 + Math.PI * secs/30;
                           mins = time.getMinutes();
                           min = -1.57 + Math.PI * mins/30;
                           hr = time.getHours();
                           hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360;
                           
                           if (NS6){
                           Ypos=window.pageYOffset+window.innerHeight-Ybase-25;
                           Xpos=window.pageXOffset+window.innerWidth-Xbase-30;
                           for (i=1; i < dots+1; i++){
                           document.getElementById("n6Digits"+i).style.top=Ypos-15+Ybase*Math.sin(-1.56 +i *Split*Math.PI/180)
                           document.getElementById("n6Digits"+i).style.left=Xpos-15+Xbase*Math.cos(-1.56 +i*Split*Math.PI/180)
                           }
                           for (i=0; i < S.length; i++){
                           document.getElementById("Nx"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(sec);
                           document.getElementById("Nx"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(sec);
                           }
                           for (i=0; i < M.length; i++){
                           document.getElementById("Ny"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(min);
                           document.getElementById("Ny"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(min);
                           }
                           for (i=0; i < H.length; i++){
                           document.getElementById("Nz"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(hrs);
                           document.getElementById("Nz"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(hrs);
                           }
                           }
                           if (NS4){
                           Ypos=window.pageYOffset+window.innerHeight-Ybase-20;
                           Xpos=window.pageXOffset+window.innerWidth-Xbase-30;
                           for (i=0; i < dots; ++i){
                           document.layers["nsDigits"+i].top=Ypos-5+Ybase*Math.sin(-1.045 +i*Split*Math.PI/180)
                           document.layers["nsDigits"+i].left=Xpos-15+Xbase*Math.cos(-1.045 +i*Split*Math.PI/180)
                           }
                           for (i=0; i < S.length; i++){
                           document.layers["nx"+i].top=Ypos+i*Ybase/4.1*Math.sin(sec);
                           document.layers["nx"+i].left=Xpos+i*Xbase/4.1*Math.cos(sec);
                           }
                           for (i=0; i < M.length; i++){
                           document.layers["ny"+i].top=Ypos+i*Ybase/4.1*Math.sin(min);
                           document.layers["ny"+i].left=Xpos+i*Xbase/4.1*Math.cos(min);
                           }
                           for (i=0; i < H.length; i++){
                            document.layers["nz"+i].top=Ypos+i*Ybase/4.1*Math.sin(hrs);
                            document.layers["nz"+i].left=Xpos+i*Xbase/4.1*Math.cos(hrs);
                            }
                           }
                           
                           if (IE4){
                           Ypos=document.body.scrollTop+window.document.body.clientHeight-Ybase-20;
                           Xpos=document.body.scrollLeft+window.document.body.clientWidth-Xbase-20;
                           for (i=0; i < dots; ++i){
                            ieDigits[i].style.pixelTop=Ypos-15+Ybase*Math.sin(-1.045 +i *Split*Math.PI/180)
                            ieDigits[i].style.pixelLeft=Xpos-15+Xbase*Math.cos(-1.045 +i *Split*Math.PI/180)
                            }
                           for (i=0; i < S.length; i++){
                            x[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(sec);
                            x[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(sec);
                            }
                           for (i=0; i < M.length; i++){
                            y[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(min);
                            y[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(min);
                            }
                           for (i=0; i < H.length; i++){
                            z[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(hrs);
                            z[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(hrs);
                            }
                           }
                           setTimeout('clock()',100);
                           }
                           clock();
                           //-->
                           </script>
                           <!-- End Analog Clock  -->
                           <!--"''"-->
Hope it helped!
__________________
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

Sponsored Links
  #2 (permalink)  
Old 01-03-2007, 09:23 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

I think I saw it on a website and I forgot the name,.. Once I got this mixed up with some other things and had some trouble. So, be carefull guys. I think this code can be better than the one I used. Thank you lol Really nice. I have just tested it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-03-2007, 09:33 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
I think I saw it on a website and I forgot the name,.. Once I got this mixed up with some other things and had some trouble. So, be carefull guys. I think this code can be better than the one I used. Thank you lol Really nice. I have just tested it.
Welcome

If you have enough HTML experience nothing will get mixed up! but yes as it is a long code you might get thing mixed up if you don't pay attention
__________________
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 TcM; 01-03-2007 at 09:35 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-03-2007, 09:56 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

Well, I may have. I think a white or similarly bright background suits this well and therefor it can be on Codecall !! only if the Admins like it to be. lol. Works on

IE7
FF2

for me. I didn't check with Opera.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-03-2007, 10:07 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

The Hour and Minute Hand, doesn't seem to work with Opera!
__________________
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

Sponsored Links
  #6 (permalink)  
Old 01-03-2007, 09:26 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

Not a BIG problem as most still use Internet Explorer and after that. It's Firefox. Only a few may use Opera and it won't be a BIG problem dude.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-18-2007, 08:59 PM
sahar88 sahar88 is offline
Newbie
 
Join Date: Feb 2007
Posts: 5
Rep Power: 0
sahar88 is on a distinguished road
Default

thank you .........
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 05-27-2008, 11:51 AM
spirates spirates is offline
Newbie
 
Join Date: May 2008
Posts: 8
Rep Power: 0
spirates is on a distinguished road
Default Help!

Hey, really nice clock i must say

But I need help :S.. Is it possible if someone kind here could make the clock in the left corner instead of the right corner? Or maybe tell me how to change it myself..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 05-27-2008, 11:56 AM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 3,471
Last Blog:
Web slideshow in JavaS...
Rep Power: 30
Xav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to all
Send a message via MSN to Xav
Default Re: Javascript: Analog Clock

This is an old thread, spirates, and should not be revived. Post the question in the correct forum.

*Thread Closed* - to the best of my ability.
__________________
Xav, the power of youth
Worship the Creator... not his creations
Web Site | Beta Site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 05-27-2008, 01:13 PM
spirates spirates is offline
Newbie
 
Join Date: May 2008
Posts: 8
Rep Power: 0
spirates is on a distinguished road
Default Re: Javascript: Analog Clock

cant you help me :<?
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
Transparent Analog Clock AfTriX VB Tutorials 6 04-28-2008 12:59 PM
Counting Files with JavaScript Matt JavaScript and CSS 5 08-01-2007 12:02 PM
Creating an analog clock with ActionScript AfTriX Tutorials, Classes and Code 2 01-07-2007 02:19 AM
javascript help!! aicirt JavaScript and CSS 9 08-01-2006 08:16 PM


All times are GMT -5. The time now is 07:30 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