I want to display date in a textbox but it didnt show. I think my code maybe wrong but im not sure.
In the textbox it shows like the picture i atach.
Code:
<script type="text/javascript">
function tDate()
{
var today = new Date();
var tMonth = new Array();
tMonth[0] = "Januari";
tMonth[1] = "Febuari";
tMonth[2] = "Mac";
tMonth[3] = "April";
tMonth[4] = "Mei";
tMonth[5] = "Jun";
tMonth[6] = "Julai";
tMonth[7] = "Ogos";
tMonth[8] = "September";
tMonth[9] = "Oktober";
tMonth[10] = "November";
tMonth[11] = "Disember";
var h = today.getHours();
var m = today.getMinutes();
var time = "am";
if(h>11) { time = "pm" }
if(h>12) { h = h - 12; }
if(h==0) { h = 12 }
document.cadangan2.dDate.value = today.getDay() + " " + tMonth[today.getMonth()] + " " +today.getFullYear() + " " + h + ":" + m + " " + time;
}
</script>
Date:<input type="text" name="ddate" value="tDate()"/>
Comment