Click here to Skip to main content
15,867,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in following code i have used a expression in alert box .how to apply that expression in a textbox named textToDate ...
JavaScript
function format()
{
    var m_names = new Array("January", "February", "March", "April", "May", "June", 
"July", "August", "September", "October", "November", "December");

    var gndate = document.getElementById("<%=txtDateTo.ClientID%>").value.split("/");
    var usedate=new Date(gndate[2],gndate[1]-1,gndate[0]);
    var today=new Date();
    var td=today.getDate();
    var gd=usedate.getDate();
    if(td==gd)
    {
    }
    else if(usedate<today)
    {
        alert("Invalid Sale Date!Enter present or future Date");
        document.getElementById("<%=txtDateTo.ClientID%>").focus();
        return false;
    }
    alert(  m_names[gndate[1]-1] +gndate[0] );
}
Posted
Updated 17-Mar-13 3:10am
v2
Comments
Prasad Khandekar 17-Mar-13 9:13am    
How about using document.getElementById("<%=txtDateTo.ClientID%>").value = m_names[gndate[1]-1] +gndate[0];
ZurdoDev 22-Mar-13 11:51am    
You should post this as the solution.
Sandeep Mewara 17-Mar-13 9:38am    
I don't see where are you setting any value in textbox. Please share what you tried that did not work.
nityasri 17-Mar-13 10:05am    
@ prasad..its working good now..thank you

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