Click here to Skip to main content
15,909,530 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is what i have tried


<input type="text" date="true" id="txtDateOfIncorporation" name="txtDateOfIncorporation" value="01/01/0001" class="Zebra_DatePicker_Icon_Wrapper hasDatepicker" style="width:150px" height="40" size="15" onload="GetDateTime()" maxlength="10">


and the function GetDatetime() is

XML
<script type="text/javascript" language="javascript">

    function GetDateTime() {

        var param1 = new Date();

        var t2 = param1.getMonth() + 1;

        var param2 = param1.getDate();

        document.getElementById('txttime').value = param2;

    }
Posted

Try this:

<script type="text/javascript" language="javascript">
function GetDateTime() {

    var param1 = new Date();
    document.getElementById('txtDateOfIncorporation').value = param1;

}
</script>


Please notice that the id you have used ('txttime') was wrong!

Call the function after DOM is ready:
HTML
<body onload="GetDateTime();"></body>
 
Share this answer
 
JavaScript
//try here
document.getElementById('txtDateOfIncorporation').value = param2;


see ref
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_text_value2[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900