With Below Code you can easily add clock in your Web page (HTML Page). This is a pure javascript code.
Need Below images to upload in your root to display clock images.
<html> <head> <!-- https://www.w3schools.com/jsref/jsref_obj_date.asp --> <title>Untitled Document</title> <script language="Javascript"> function Go() { /* original by Tim Van Goethem, tim@uophetnet.com */ nu = new Date(); hr = nu.getHours(); min = nu.getMinutes(); sec = nu.getSeconds(); ext = ".gif"; if(hr<="9"){hr = "0" + hr;} else {hr = "" + hr;} if(min<="9"){min = "0" + min;} else {min = "" + min;} if(sec<="9"){sec = "0" + sec;} else {sec = "" + sec;} /* Get Hours */ hrc = hr.substring(0,1); hrd = hr.substring(1,2); /* Set Images for Hours */ document.images.hra.src = "" + hrc + ext; document.images.hrb.src = "" + hrd + ext; /* Get Minutes */ minc = min.substring(0,1); mind = min.substring(1,2); /* Set Images for Minutes */ document.images.mina.src = "" + minc + ext; document.images.minb.src = "" + mind + ext; /* Get Seconds */ secc = sec.substring(0,1); secd = sec.substring(1,2); /* Set Images for Seconds */ document.images.seca.src = "" + secc + ext; document.images.secb.src = "" + secd + ext; setTimeout("Go()", 20); } </script> </head> <body onLoad="Go();"> <img src="" name=hra> <img src="" name=hrb> <img src="y.gif"> <img src="" name=mina> <img src="" name=minb> <img src="y.gif"> <img src="" name=seca> <img src="" name=secb> </body> </html>
Need Below images to upload in your root to display clock images.
0 Comments