Dharmesh Sharma

Dharmesh Sharma

  • NA
  • 905
  • 927k

check my javascript and give me error

Sep 30 2010 7:52 AM
i have three dropdown in asp.net Day month year

now i chech the wich one is has select and give me message

this is java script
  function validdate(obj1,obj2,obj3)
        {
        if((document.getElementById(obj1).value=="Day")&&(document.getElementById(obj2).value=="Month")&&((document.getElementById(obj3).value=="Year")))
            {
               document.getElementById('<%=ltmsg.ClientID%>').innerText='Date is mandatory.';
            }
            else if((document.getElementById(obj1).value=="Day")&&(document.getElementById(obj2).value=="Month"))
            {
             document.getElementById('<%=ltmsg.ClientID%>').innerText='Date is mandatory.';
            }
            else if(document.getElementById(obj1).value=="Day")
            {
             document.getElementById('<%=ltmsg.ClientID%>').innerText='Date is mandatory.';
            }
            else if(document.getElementById(obj2).value=="Month")
            {
            document.getElementById('<%=ltmsg.ClientID%>').innerText='Month is mandatory.';
            }
            else if(document.getElementById(obj3).value=="Year")
            {
            document.getElementById('<%=ltmsg.ClientID%>').innerText='Year is mandatory.';
            }
            else
            {
            document.getElementById('<%=ltmsg.ClientID%>').innerText='';
            }
           
        }

n this is c# code in form load


 ddl_day.Attributes.Add("onchange", "javascript:validdate('" + ddl_day.ClientID + "','" + ddl_month.ClientID + "','" + ddl_year.ClientID + "');");
        ddl_month.Attributes.Add("onchange", "javascript:validdate('" + ddl_day.ClientID + "','" + ddl_month.ClientID + "','" + ddl_year.ClientID + "');");
        ddl_year.Attributes.Add("onchange", "javascript:validdate('" + ddl_day.ClientID + "','" + ddl_month.ClientID + "','" + ddl_year.ClientID + "');");


please help me



Answers (6)