Membuat tanggal dengan JavaScript

|

Demo :

01/04/2011


Kode :

Penempatan kode :
dibawah <body>
........
diatas </body>

Kodenya :
<script type='text/javascript'>
//<![CDATA[
/*Tanggal script credit: 
JavaScript Kit (http://www.javascriptkit.com/script/cut165.shtml)
*/
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()+1
if (month<10)
month="0"+month
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
document.write("<font color='000000' face='Arial'><b>"+daym+"/"+month+"/"+year+"</b></font>")
//]]>
</script>

0 komentar:

Posting Komentar

Next Prev
▲Top▲