-
Junior Member
Re: What is the problem in this code ?
In your javascript,you have already stored the year values in y1 and y2.Then y do u need to assign them to x1 and x2?? Exclude x1 and x2 assignment statements and change the if condition to compare y1 and y2.The modified code has been given below.
function checkYear()
{
var y1= document.getElementById("FY");
var y2= document.getElementById("TY");
/*x1=y1.options[y1.selectedIndex].value;
x2=y2.options[y2.selectedIndex].value; */
if(y1 >y2)
{
alert("'From' year should be less than or equal to 'To' year");
return false;
}
else
return true;
}
Excecute the above script and it might work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules