Membuat tanggal dengan JavaScript

Demo :




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>



Script by JavaScript Kit

Alhamdulillah

0 comments:


Posting Komentar


Creative Commons License
Membuat tanggal dengan JavaScript by Nano Yulianto is licensed under a Creative Commons Attribution 3.0 Unported License.
Based on a work at http://nanoyulianto.blogspot.com/2011/01/membuat-tanggal-dengan-javascript.html.
Permissions beyond the scope of this license may be available at http://nanoyulianto.blogspot.com/.