File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Help wanted on control select/option by javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Help wanted on control select/option by javascript" Watch "Help wanted on control select/option by javascript" New topic
Author

Help wanted on control select/option by javascript

Lisa Yu
Greenhorn

Joined: Dec 27, 2000
Posts: 3
I have the code list below, and I want by function "fControlDay(iMonth, iDay)" to control the available days list in the "ListFromDay".
Can anybody kindly help me?

<html>
<head>
<title>Phantom Employee Time Off Request Form</title>
<meta http-equiv="Content-Type" content="text/html">
<SCRIPT LANGUAGE="JavaScript">
<!-- This script will set and check values about the date. -->
<!-- Begin
var msPerDay = 24*60*60*1000;

<!-- This function was called to calculate total days between from/to date-->
function fGetDatesDays(iFYear, iFMonth, iFDay, iTYear, iTMonth, iTDay, oDays) {
iFDate = new Date((iFYear.value*1), (iFMonth.value*1)-1, (iFDay.value*1));
iTDate = new Date((iTYear.value*1), (iTMonth.value*1)-1, (iTDay.value*1));
daysLeft = (iTDate.getTime() - iFDate.getTime()) / msPerDay;
daysLeft = Math.round(daysLeft);
oDays.value = daysLeft;
}
<!-- This function was called to control days selection -->
function fControlDay(iMonth, iDay) {
<!-- iDay[30].disabled = "false"; -->
<!-- iDay[30].disabled = "false"; -->
<!-- iDay.option[31].disabled = "false"; -->
}
// End -->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="formRequest" method="post" action="">
<p align="center">
<Table width="800" border = "0">
<TBODY>
<TR>
<TD width="300"> </TD>
<TD width="300" align="left">
<TABLE width="240" border="0">
<TR>
<TD width="80" align="left">From: </TD>
<TD width="60 align="right">
<select name="ListFromYear" size="1" onchange="fGetDatesDays(ListFromYear, ListFromMonth, ListFromDay, ListToYear, ListToMonth, ListToDay, TFDatesDays)">
<option value=2001 selected>2001</option>
<option value=2002>2002</option>
</select>
</TD>
<TD width="50 align="center">
<select name="ListFromMonth" size="1" onchange="fControlDay(ListFromMonth, ListFromDay)">
<option value=01 selected>Jan</option>
<option value=02>Feb</option>
<option value=03>Mar</option>
<option value=04>Apr</option>
<option value=05>May</option>
<option value=06>Jun</option>
<option value=07>Jul</option>
<option value=08>Aug</option>
<option value=09>Sep</option>
<option value=10>Oct</option>
<option value=11>Nov</option>
<option value=12>Dec</option>
</select>
</TD>
<TD width="40 align="center">
<select name="ListFromDay" size="1" onchange="fGetDatesDays(ListFromYear, ListFromMonth, ListFromDay, ListToYear, ListToMonth, ListToDay, TFDatesDays)">
<option value=01 selected>01</option>
<option value=02>02</option>
<option value=03>03</option>
<option value=04>04</option>
<option value=05>05</option>
<option value=06>06</option>
<option value=07>07</option>
<option value=08>08</option>
<option value=09>09</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
</select>
</TD>
</TR>
<TR>
<TD width="80" align="left">To: </TD>
<TD width="60 align="right">
<select name="ListToYear" size="1" onchange="fGetDatesDays(ListFromYear, ListFromMonth, ListFromDay, ListToYear, ListToMonth, ListToDay, TFDatesDays)">
<option value=2001 selected>2001</option>
<option value=2002>2002</option>
<option value=2003>2003</option>
<option value=2004>2004</option>
<option value=2005>2005</option>
</select>
</TD>
<TD width="50 align="center">
<select name="ListToMonth" size="1" onchange="fGetDatesDays(ListFromYear, ListFromMonth, ListFromDay, ListToYear, ListToMonth, ListToDay, TFDatesDays)">
<option value=01 selected>Jan</option>
<option value=02>Feb</option>
<option value=03>Mar</option>
<option value=04>Apr</option>
<option value=05>May</option>
<option value=06>Jun</option>
<option value=07>Jul</option>
<option value=08>Aug</option>
<option value=09>Sep</option>
<option value=10>Oct</option>
<option value=11>Nov</option>
<option value=12>Dec</option>
</select>
</TD>
<TD width="40 align="center">
<select name="ListToDay" size="1" onchange="fGetDatesDays(ListFromYear, ListFromMonth, ListFromDay, ListToYear, ListToMonth, ListToDay, TFDatesDays)">
<option value=01 selected>01</option>
<option value=02>02</option>
<option value=03>03</option>
<option value=04>04</option>
<option value=05>05</option>
<option value=06>06</option>
<option value=07>07</option>
<option value=08>08</option>
<option value=09>09</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
</select>
</TD>
</TR>
</TABLE>
</TD>
<TD width="200" align="left">
<font size="2"><input type="text" name="TFDatesDays" size="3"> (Total days)</font>
</TD>
</TR>
</TBODY>
</TABLE>
</P>
</form>
</body>
</html>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help wanted on control select/option by javascript
 
Similar Threads
raw HTML in Mozilla
display date(formatted with select boxes) from oracle DB in jsf
DYNAMIC LIST BOX
s:doubleselect exception/ error
Problem in using date in WHERE clause in SELECT query in Servlet.