<%@page import="java.util.Calendar"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>employee leave application</title>
<script src="EmpLeaveValidation.js" type="text/javascript"></script>
<style type="text/css">
#ehint {
	position: absolute;
	right: 230px;
	top: 18px;
}

#cnhint {
	position: absolute;
	right: 200px;
	top: 40px;
}

#chint {
	position: absolute;
	right: 200px;
	top: 70px;
}

#rhint {
	position: absolute;
	right: 230px;
	top: 110px;
}

#lhint {
	position: absolute;
	right: 180px;
	top: 130px;
}

#ahint {
	position: absolute;
	right: 250px;
	top: 160px;
}
#empalign{
position:absolute;
right:500px;
left:500px;
}
#fromdatealign{
position:absolute;
right:550px;
left:500px;
}
#fromdayalign{
position:absolute;
right:500px;
left:690px;
}
#fromyearalign{
position:absolute;
right:100px;
left:755px;
}
#todatealign{
position:absolute;
right:550px;
left:500px;
}
#todayalign{
position:absolute;
right:500px;
left:690px;
}
#toyearalign{
position:absolute;
right:100px;
left:755px;
}
#reasonalign{
position:absolute;
right:500px;
left:500px;
}
#leavealign{
position:absolute;
right:500px;
left:500px;
}
#approvalstatusalign{
position:absolute;
right:500px;
left:505px;
}
#submitalign{
position:absolute;
right:500px;
left:550px;
}
#resetalign{
position:absolute;
right:200px;
left:650px;
}
</style>
</head>
<body bgcolor="white">
<form action="Emp_Leave_Connector.jsp" name="f1" method="post"
	onsubmit="return validateForm()">

	<div id="empalign">
		EmpId:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="text" id="eid" name="empId">
		</div>
		<div id="ehint"></div><br><br>
		
	<div id="fromdatealign">
		From Date:
		<select id="cname" name="fromDate">
			<option value="0">select</option>
			<option value="1">January</option>
			<option value="2">February</option>
			<option value="3">March</option>
			<option value="4">April</option>
			<option value="5">May</option>
			<option value="6">June</option>
			<option value="7">July</option>
			<option value="8">August</option>
			<option value="9">September</option>
			<option value="10">October</option>
			<option value="11">November</option>
			<option value="12">December</option>
			</select>
</div>

		<div id="fromdayalign"> <select id="cname" name="fromDay">
			<option value="0">select</option>
			<%
				for (int j = 01; j < 31; j++) {
			%>

			<option value="<%=j %>"><%=j%></option>
			<%
				}
			%>
		</select></div>
		<div id="fromyearalign"> <select id="cname" name="fromYear">
			<option value="0">select</option>
			<%
				for (int i = 2010; i <= 2020; i++) {
			%>

			<option value="<%=i %>"><%=i%></option>

			<%
				}
			%>
		</select>

		</div>
		<div id="cnhint"></div><br><br>
		<div id="todatealign">
		ToDate:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		
		
	<select id="chvalue" name="toDate">
			<option value="0">select</option>
			<option value="1">January</option>
			<option value="2">February</option>
			<option value="3">March</option>
			<option value="4">April</option>
			<option value="5">May</option>
			<option value="6">June</option>
			<option value="7">July</option>
			<option value="8">August</option>
			<option value="9">September</option>
			<option value="10">October</option>
			<option value="11">November</option>
			<option value="12">December</option>


		</select> </div>
		<div id="todayalign"><select id="chvalue" name="toDay">
			<option value="0">select</option>
			<%
				for (int k = 1; k < 31; k++) {
			%>
			<option value="<%=k %>"><%=k%></option>
			<%
				}
			%>

		</select>
		</div>
		 <div id="toyearalign"><select id="chvalue" name="toYear">
		<option value="0">select</option>
			<%
				for (int i = 2010; i <= 2020; i++) {
			%>

			<option value="<%=i %>"><%=i%></option>

			<%
				}
			%>
		</select>
		</div>
		<div id="chint"></div><br><br>
		
	<div id="reasonalign">
		Reason:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="text" id="rvalue" name="reason">
		</div>
		<div id="rhint"></div><br><br>
		
		
<div id="leavealign">
		LeaveType:
		<select id="ltype" name="leaveType">
			<option value="choose">choose</option>
			<option value="general">general</option>
			<option value="sick">sick</option>
			<option value="earned leave">earned leave</option>

		</select>
		</div>
		
		<div id="lhint"></div><br><br>
		
	<div id="approvalstatusalign">
		Approval<br>Status:&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="radio" id="avalue" name="approvalStatus"
			value="pending">pending <input type="radio" id="a1value"
			value="approved" name="approvalStatus" value="approved">approved
		<input type="radio" id="a2value" value="rejected"
			name="approvalStatus" value="rejected">rejected</td>
		</div>
		<div id="ahint"></div><br><br><br>
		
	


		<div id="submitalign">&nbsp;&nbsp;&nbsp;<input type="submit" value="submit"></div>
		<div id="resetalign"><input type="reset" value="reset"></div>
	

</form>
</body>
</html>

how can i change the days in the days field automatically when the user selects a month...can anyone guide me

Write a javascript function that reads the month from the form field and then updates the values in the today field (similar to your jsp function) with values stopping at the correct upper limit.

Then call this function in the onchange event on the month select.

I would suggest that you try useing jQuery and it's datepicker.js functionality. it's pretty cool.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.