
i want to insret the current date in textbox but this code dosen't work and the value of text box will be blank
<script type="text/javascript">
function addDate() {
var mydate = new Date();
var year = mydate.getFullYear();
var day = mydate.getDay();
var month = mydate.getmon() + 1;
if (month < 10) {
month = "0" + month;
}
var daym = mydate.getDate()
if (daym < 10)
{
daym = "0" + daym;
}
today = day + month + year;
return today;
}
window.onload = function()
{
document.theForm.text3.value = addDate();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
Today date is : <input type="text" id="txtdate" />
<INPUT id=text3 name=text3 />
</div>
</form>
</body>
</html>

Here is a javascript code that insert the current date into textbox on page load.
<html>
<script>
function addDate(){
date = new Date();
var month = date.getMonth()+1;
var day = date.getDate();
var year = date.getFullYear();
if (document.getElementById('date').value == ''){
document.getElementById('date').value = day + '-' + month + '-' + year;
}
}
</script>
<body onload="addDate();">
Today's Date is: <input type="text" id="date">
</body>
</html>

thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.