neilsav
asked on
How do I occupy a text field using javascript?
I am trying to occupy a text field (t_employment__start_date) on my aspx web page using javascript. The function is contained in another file that the page calls (I know this is mapped correctly because another function is used and working correctly on the page). This is the javascript function I created:
function PopulateDate()
{
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.getElementById('t _employmen t__start_d ate').valu e =(month + "/" + day + "/" + year);
}
Attached is the source for the web page
Any advice? Thanks.
pagesource.htm
function PopulateDate()
{
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.getElementById('t
}
Attached is the source for the web page
Any advice? Thanks.
pagesource.htm
nothing wrong in this script
<input id='t_employment__start_date'>
<script>
function PopulateDate(){
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.getElementById('t_employment__start_date').value =(month + "/" + day + "/" + year);
}
PopulateDate()
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER