I have another problem with javascript. When I click on one of the date
boxes I get an error on line 41 char 4 expected ';' code 0.
line 41 is the java script function turn on. Please help if you can.
Joshua Tipton
<CFIF IsDefined("URL.EmployeeID") and IsDefined("URL.Yr")>
<CFOUTPUT>
<CFQUERY name="qryEmployees" dbtype="ODBC"
datasource="#Application.DataSource#">
SELECT * FROM Employees
WHERE (RR = '#URL.RR#') AND
(DD = '#URL.DD#') AND
(Center = '#URL.Center#') AND
(Dept = '#URL.Dept#') AND
(SubDept = '#URL.SubDept#')
ORDER BY StartDate, LName, FName
</CFQUERY>
<CFQUERY name="qryEmployee" dbtype="ODBC"
datasource="#Application.DataSource#">
SELECT * FROM Employees
WHERE EmployeeID='#URL.EmployeeID#'
</CFQUERY>
</CFOUTPUT>
<!DOCTYPE html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE><cfoutput>#URL.Yr# Vacation Schedule for #URL.Center#,
#URL.Dept# - #URL.SubDept#</cfoutput></TITLE>
<cfoutput>
<script language="JScript">
function TurnOff(){
var oObject = document.all.item("Day");
if (oObject != null){
if (oObject.length != null){
for (i = 0; i < oObject.length; i++){
oObject(i).disabled=true;
}
}
else{
oObject.disabled=true;
}
}
}
function TurnOn(){
var oObject = document.all.item("Day");
if (oObject != null){
if (oObject.length != null){
for (i = 0; i < oObject.length; i++){
oObject(i).disabled=false;
}
}
else{
oObject.disabled=false;
}
}
}
function ChoseWeek(BoxID, DisplayDate){
var oObject = eval(BoxID);
if (oObject.innerText=="X"){
TurnOff();
document.all.item("FullWeek").focus();
}
document.write(oObject.innerText);
if (oObject.innerText.value > 0){
TurnOn();
document.all.item("PartWeek").focus();
}
WeekEndingDate.innerHTML=DisplayDate;
}
</script>
</cfoutput>
</HEAD>
<BODY leftmargin=0 topmargin=0 style="font-family: sans-serif;"
OnLoad="TurnOff();">
<div align="center">
<B><FONT size="4"><cfoutput>#URL.Yr# Vacation Schedule for
#URL.Center#,
#URL.Dept# - #URL.SubDept#</cfoutput></FONT></B><br>
<CFOUTPUT QUERY="qryEmployee">
<strong>Vacation for:
<font color="Blue">#FName# #LName#</font>
Week Ending:
<font color="Blue">
<span id="WeekEndingDate">
<CFIF isdefined("WED")>#WED#</CFIF>
</SPAN>
</font></strong>
</CFOUTPUT>
</div>
<CFOUTPUT>
<div align="center" style="font-size: x-small;">
<form action="Check_Vacation_Entry.cfm" method="post">
<div style="border: thin solid Black; width: 450px; background-color:
Silver;">
<input type="radio" name="Full_Week" id="FullWeek" value="Yes"
checked
onClick="TurnOff();"><strong>Full Week:</strong>
</DIV>
<hr width="400">
<div style="border: thin solid Black; width: 450px; background-color:
Silver;">
<input type="radio" name="Full_Week" id="PartWeek" value="No"
onClick="TurnOn();"><strong>Partial Week:</strong><BR>
<input type="checkbox" name="Sun" id="Day"
value="Off"><strong><font
color="Red">Sun</font></strong>
<input type="checkbox" name="Mon" id="Day"
value="Off"><strong>Mon</strong>
<input type="checkbox" name="Tue" id="Day"
value="Off"><strong>Tue</strong>
<input type="checkbox" name="Wed" id="Day"
value="Off"><strong>Wed</strong>
<input type="checkbox" name="Thu" id="Day"
value="Off"><strong>Thu</strong>
<input type="checkbox" name="Fri" id="Day"
value="Off"><strong>Fri</strong>
<input type="checkbox" name="Sat" id="Day"
value="Off"><strong><font
color="Red">Sat</font></strong>
</DIV>
<BR>
<div align="center"><input type="submit" value="Submit"> <input
type="reset" value="Cancel"
onClick="window.location.replace('Vacation_EntryForm.cfm?#Client.URLToken#')
;"></div>
</FORM>
</DIV>
<CFSET EmpDaysUsed=ArrayNew(1)>
<CFSET WkTotals=ArrayNew(1)>
<CFSET Temp=ArraySet(WkTotals,1,54,0)>
<CFSET Temp=ArraySet(EmpDaysUsed,1,qryEmployees.RecordCount,0)>
<CFLoop step="1" to="2" from="1" index="Part">
<CFSET StartMonth = 1 + ((Part -1)*6)>
<CFLOOP step="1" to="7" from="1" index="FirstSatDay">
<CFIF DayOfWeek(CreateDate(#URL.Yr#,
#StartMonth#, #FirstSatDay#)) is
7>
<CFBREAK>
</CFIF>
</CFLOOP>
<table border="1" cellspacing="0" align="center"
name="VacGrid"
id="VacGrid" style="BORDER: black 2px solid; font-size: 8pt;">
<THEAD>
<tr bgcolor="FF8080" style="BORDER:
black 2px solid;">
<td rowspan="2" style="BORDER:
black 1px solid; text-align:
center;"><B>Employee<BR>Name</B></td>
<CFIF Part is 1>
<TD rowspan="2" style="BORDER:
black 1px solid; text-align:
center;"><B>Eligibility<BR>Date</B></TD>
<td rowspan="2" style="BORDER:
black 1px solid; text-align:
center;"><B>Wks<BR>/Yr</B></td>
</CFIF>
<cfSet DaysInTerm=0>
<CFLOOP step="1"
to="#Evaluate('6 * #Part#')#" from="#StartMonth#"
index="Mnth">
<CFSET
WeeksInMonth=Int((DaysInMonth(CreateDate(URL.Yr, Mnth, 1)) -
(8-DayOfWeek(CreateDate(URL.Yr, Mnth, 1)))) / 7) + 1>
<CFSET DaysInTerm =
DaysInTerm + DaysInMonth(CreateDate(URL.Yr,
Mnth, 1))>
<td
colspan="#WeeksInMonth#" bgcolor="#IIf(Mnth Mod 2,
DE('80FFFF'), DE('80FF80'))#" style="BORDER: black 2px solid; text-align:
center;"><B>#MonthAsString(Mnth)#</B></td>
</CFLOOP>
<CFIF Part is 2>
<td rowspan="2"
bgcolor="##FFB062" style="border-top-width: 2px;
border-bottom-width: 2px; border-color: Black; text-align:
center;"><strong>Wks.<br>Used</strong></td>
<td rowspan="2"
bgcolor="##BE7DFF" style="border-top-width: 2px;
border-bottom-width: 2px; border-color: Black; text-align:
center;"><strong>Wks.<br>Left</strong></td>
</CFIF>
</TR>
<TR>
<CFIF Part is 1>
<CFSET TermEnd =
DaysInTerm>
<CFELSE>
<CFSET TermEnd =
DaysInYear(CreateDate(URL.Yr, 1, 1)) - TermEnd>
</CFIF>
<CFLOOP step="7"
to="#TermEnd#" from="#FirstSatDay#" index="SatDay">
<CFSET
SatDate=DateAdd("d", SatDay, DateAdd("d",
(part-1)*((DaysInYear(CreateDate(URL.Yr, 1, 1))) -
DaysInTerm),CreateDate(URL.Yr-1, 12, 31)))>
<CFSET
Prev=Day(SatDate) - 7><CFSET Nxt=Day(SatDate) + 7><CFSET
DPM=DaysInMonth(SatDate)>
<TD
bgcolor="#IIf(Month(SatDate) Mod 2, DE('80FFFF'),
DE('80FF80'))#" style="cursor : hand; #iif(Prev LTE 0, de('BORDER-LEFT:black
2px solid; '), de('BORDER-LEFT:black 1px solid; '))##iif(Nxt GT DPM,
de('BORDER-RIGHT:black 2px solid; '), de('BORDER-RIGHT:black 1px solid;
'))#BORDER-BOTTOM: black 2px solid; BORDER-TOP: black 2px solid; text-align:
center;">
<B>#numberformat(Day(SatDate),"09")#</B>
</TD>
</CFLOOP>
</TR>
</THEAD>
<CFSET RN=0><CFSET TotalWeeks=0>
<CFLoop query="qryEmployees">
<CFSet TotalWeeks=TotalWeeks+NoWeeks>
<CFSET RN=RN+1>
<CFIF RN Mod 2 is 1>
<CFSET
BkColor="ffffcc"><cfset
OddBC=right("000000"&FormatBaseN(49344, 16),6)><cfset
evenBC=right("000000"&FormatBaseN(49152, 16),6)><CFSET
FrameColor="Black"><CFSET FrameSize=1><CFSET LinkColor="Blue">
<cfelse>
<CFSET
BkColor="ffffff"><cfset
OddBC=right("000000"&FormatBaseN(8454143, 16),6)><cfset
evenBC=right("000000"&FormatBaseN(8454016, 16),6)><CFSET
FrameColor="Black"><CFSET FrameSize=1><CFSET LinkColor="Blue">
</cfif>
<CFIF EmployeeID is
URL.EmployeeID>
<CFSET
BkColor="##FFFF00"><cfset OddBC="##FEFFA3"><cfset
evenBC="##FFFF00"><CFSET FrameColor="Black"><CFSET LinkColor="Red"><CFSET
FrameSize=2><CFSET SelectedEmployee=RN>
</CFIF>
<TR bgcolor="#BkColor#"
bordercolor="#FrameColor#" id="#RN#">
<td style="border-top:
#FrameColor# #FrameSize#px; border-bottom:
#FrameColor# #FrameSize#px; border-color: #FrameColor# ;" nowrap><font
style="color: #LinkColor#;">#FName# #LName#</Font></td>
<CFIF Part is 1>
<td style="border-top:
#FrameColor# #FrameSize#px; border-bottom:
#FrameColor# #FrameSize#px; border-color: #FrameColor#;"
nowrap><b> #DateFormat(StartDate, "Mm-dd-yy")#</b></td>
<td style="border-top:
#FrameColor# #FrameSize#px; border-bottom:
#FrameColor# #FrameSize#px; border-color: #FrameColor#; text-align: center;"
nowrap><b>#NoWeeks#</b></td>
</CFIF>
<cfquery
name="qryVacDatesPerEmp"
datasource="#application.DataSource#" dbtype="ODBC" username="webuser"
password="webuser">
SELECT *
FROM Vacations
WHERE EmployeeID='#EmployeeID#'
</cfquery>
<CFLOOP step="7"
to="#TermEnd#" from="#FirstSatDay#" index="SatDay">
<CFSET
SatDate=DateAdd("d", SatDay, DateAdd("d",
(part-1)*((DaysInYear(CreateDate(URL.Yr, 1, 1))) -
DaysInTerm),CreateDate(URL.Yr-1, 12, 31)))>
<CFSET
Prev=Day(SatDate) - 7><CFSET Nxt=Day(SatDate) + 7><CFSET
DPM=DaysInMonth(SatDate)>
<CFIF Month(SatDate)
Mod 2 is 0><cfset
BkgColor=evenBC><cfelse><cfset BkgColor=OddBC></cfif>
<CFSET
WkNum=DatePart("ww", SatDate)>
<CFSet ShowDates="">
<CFIF OddBC is
"##FEFFA3">
<TD
onClick='ChoseWeek(this.id, "#dateformat(SatDate,
'mm/dd/yyyy')#");' align="center" valign="top" id="#RN#_#WkNum#"
bgcolor="#BkgColor#" style="cursor : hand; BORDER-BOTTOM: #FrameColor# 2px
solid; BORDER-TOP: #FrameColor# 2px solid; text-align: center; #iif(Prev LTE
0, de('BORDER-LEFT:#FrameColor# 2px solid; '), de('BORDER-LEFT:#FrameColor#
1px solid; '))##iif(Nxt GT DPM, de('BORDER-RIGHT:#FrameColor# 2px solid; '),
de('BORDER-RIGHT:#FrameColor# 1px solid; '))#" nowrap>
<CFELSE>
<TD
align="center" valign="top" id="Wk#WkNum#" bgcolor="#BkgColor#"
style="cursor : hand; BORDER-BOTTOM: #FrameColor# 2px solid; BORDER-TOP:
#FrameColor# 2px solid; text-align: center; #iif(Prev LTE 0,
de('BORDER-LEFT:#FrameColor# 2px solid; '), de('BORDER-LEFT:#FrameColor# 1px
solid; '))##iif(Nxt GT DPM, de('BORDER-RIGHT:#FrameColor# 2px solid; '),
de('BORDER-RIGHT:#FrameColor# 1px solid; '))#" nowrap>
</CFIF>
<CFLoop
query="qryVacDatesPerEmp">
<CFIF
#WE_Date# is #SatDate#>
<CFIF #FullWeek# is true>
<span align="center" title="Full Week" style="cursor :
help;"><strong>X</strong></span>
<CFSET WkTotals[WkNum] = #WkTotals[WkNum]# + 5>
<CFSET EmpDaysUsed[RN] = #EmpDaysUsed[RN]# + 5>
<CFELSE>
<CFSET ShowDates = "Vacation Days:">
<CFIF Sun is True><CFSET ShowDates = ShowDates & chr(13) & "Sun.
" & "#DateFormat( DateAdd("d", -6, SatDate), "mm-dd-yyyy")#"></CFIF>
<CFIF Mon is True><CFSET ShowDates = ShowDates & chr(13) & "Mon.
" & "#DateFormat( DateAdd("d", -5, SatDate), "mm-dd-yyyy")#"></CFIF>
<CFIF Tue is True><CFSET ShowDates = ShowDates & chr(13) & "Tue.
" & "#DateFormat( DateAdd("d", -4, SatDate), "mm-dd-yyyy")#"></CFIF>
<CFIF Wed is True><CFSET ShowDates = ShowDates & chr(13) & "Wed.
" & "#DateFormat( DateAdd("d", -3, SatDate), "mm-dd-yyyy")#"></CFIF>
<CFIF Thu is True><CFSET ShowDates = ShowDates & chr(13) & "Thu.
" & "#DateFormat( DateAdd("d", -2, SatDate), "mm-dd-yyyy")#"></CFIF>
<CFIF Fri is True><CFSET ShowDates = ShowDates & chr(13) & "Fri.
" & "#DateFormat( DateAdd("d", -1, SatDate), "mm-dd-yyyy")#"></CFIF>
<CFIF Sat is True><CFSET ShowDates = ShowDates & chr(13) & "Sat.
" & "#DateFormat( SatDate, "mm-dd-yyyy")#"></CFIF>
<span align="center" title="#ShowDates#" style="cursor :
help;"><strong>#NoDays#</strong></span>
<CFSET WkTotals[WkNum] = #WkTotals[WkNum]# + #NoDays#>
<CFSET EmpDaysUsed[RN] = #EmpDaysUsed[RN]# + #NoDays#>
</CFIF>
<CFELSE>
</CFIF>
</cfloop>
<CFIF
qryVacDatesPerEmp.RecordCount eq 0>
</CFIF>
</td>
</cfloop>
<CFIF Part is 2>
<CFIF EmployeeID is
URL.EmployeeID>
<td
bgcolor="#OddBC#" style="border-top-width: 2px;
border-bottom-width: 2px; border-color: Black;; text-align:
right"><strong>#NumberFormat(Evaluate('#EmpDaysUsed[CurrentRow]# / 5'),
'0.0')#</strong></td>
<td
bgcolor="#evenBC#" style="border-top-width: 2px;
border-bottom-width: 2px; border-color: Black;; text-align:
right"><strong>#NumberFormat(Evaluate('#NoWeeks# -
(#EmpDaysUsed[CurrentRow]# / 5)'), '0.0')#</strong></td>
<CFElse>
<td
bgcolor="##FFB062" style="border-top-width: 2px;
border-bottom-width: 2px; border-color: Black;; text-align:
right"><strong>#NumberFormat(Evaluate('#EmpDaysUsed[CurrentRow]# / 5'),
'0.0')#</strong></td>
<td
bgcolor="##BE7DFF" style="border-top-width: 2px;
border-bottom-width: 2px; border-color: Black;; text-align:
right"><strong>#NumberFormat(Evaluate('#NoWeeks# -
(#EmpDaysUsed[CurrentRow]# / 5)'), '0.0')#</strong></td>
</CFIF>
</CFIF>
</TR>
</CFLoop>
<tr>
<td colspan="#IIF(Part is 1, DE('2'),
DE('1'))#" bgcolor="FF8080"
style="border-top-width: 2px; border-bottom-width: 1px; border-color: Black;
text-align: center;"><b>Totals</b></td>
<CFIF Part is 1>
<td bgcolor="Yellow"
style="border-top-width: 2px;
border-bottom-width: 1px; border-color: Black; text-align:
center;"><b>#TotalWeeks#</b></td>
</CFIF>
<CFSET BkColor='ffffff'><cfset
OddBC=right("000000"&FormatBaseN(16777215, 16),6)><cfset
evenBC=right("000000"&FormatBaseN(12632256, 16),6)>
<CFLOOP step="7" to="#TermEnd#" from="#FirstSatDay#"
index="SatDay">
<CFSET SatDate=DateAdd("d", SatDay, DateAdd("d",
(part-1)*((DaysInYear(CreateDate(URL.Yr, 1, 1))) -
DaysInTerm),CreateDate(URL.Yr-1, 12, 31)))>
<CFSET Prev=Day(SatDate) - 7><CFSET Nxt=Day(SatDate) + 7><CFSET
DPM=DaysInMonth(SatDate)>
<CFIF Month(SatDate) Mod 2 is 0><cfset
BkgColor=evenBC><cfelse><cfset BkgColor=OddBC></cfif>
<CFSET WkNum=DatePart("ww", SatDate)>
<TD bgcolor="#BkgColor#" style="color : black;font-size :
8pt;#iif(Prev LTE 0, de('BORDER-LEFT:black 2px solid; '),
de('BORDER-LEFT:black 1px solid; '))##iif(Nxt GT DPM, de('BORDER-RIGHT:black
2px solid; '), de('BORDER-RIGHT:black 1px solid; '))#BORDER-BOTTOM: black
1px solid; BORDER-TOP: black 2px solid; text-align: center;" nowrap>
<strong>#IIF(Evaluate('#WkTotals[WkNum]# / 5') is not 0,
NumberFormat(Evaluate('#WkTotals[WkNum]# / 5'), '0.0'),
Evaluate('#WkTotals[WkNum]# / 5'))#</strong>
</td>
</cfloop>
<CFIF Part is
2>
<td
bgcolor="##FA7C00" style="border-top-width: 2px;
border-bottom-width: 2px; border-color: Black;; text-align:
right"><strong>#NumberFormat(Evaluate('#ArraySum(EmpDaysUsed)# / 5'),
'0.0')#</strong></td>
<td
bgcolor="##D9B7FF" style="border-top-width: 2px;
border-bottom-width: 2px; border-color: Black;; text-align:
right"><strong>#NumberFormat(Evaluate('#TotalWeeks# -
(#ArraySum(EmpDaysUsed)# / 5)'), '0.0')#</strong></td>
</cfif>
</tr>
</TABLE>
<BR>
</CFLOOP>
<table border="1" cellspacing="0" cellpadding="0" align="center"
bordercolor="Black" style="font-size: x-small; border: thin solid Black;">
<tr align="center" bgcolor="Black"><td colspan="3"><font
color="White"><strong>Table Map</strong></font></td></TR>
<TR align="center" bgcolor="Silver"><td rowspan="3"
valign="middle"><strong>Calendar Section</strong></td><td width="40%"
bgcolor="##00C0C0" style="border: thin solid Black;"> </td><TD
width="40%" bgcolor="##00C000" style="border: thin solid
Black;"> </TD></TR>
<TR><td colspan="2"><strong> X </strong>
= Employee
has scheduled the full week off.</td></TR>
<TR><td colspan="2"><strong>1 - 4</strong> = Employee has
scheduled the
number of <strong>days</strong> indicated off durring that week.<br><div
align="center"><font color="Red"><strong><em>Point to the number to get a
list of days off durring that week.</em></strong></font></div></td></TR>
<tr align="center" bgcolor="Silver"><td rowspan="2"
nowrap><strong>Employee Totals<br>Section</strong></td><TD width="40%"
bgcolor="##FFB062" style="border: thin solid Black;"> </TD><td
width="40%" bgcolor="##BE7DFF" style="border: thin solid
Black;"> </td></TR>
<TR><td colspan="2">Indicates total <strong>weeks</strong> of
scheduled
and unscheduled vacation time per employee.</td></TR>
<TR align="center" bgcolor="Silver"><td rowspan="2"
nowrap><strong>Week
Totals<br>Section</strong></td><TD bgcolor="White" width="40%"
style="border: thin solid Black;"> </TD><TD width="40%" style="border:
thin solid Black;"> </TD></TR>
<TR><td colspan="2">Indicates total <strong>weeks</strong> of
scheduled
vacation time per calendar week.</td></TR>
</TABLE>
</cfoutput>
</BODY>
</HTML>
<CFELSE>
<cflocation url="Vacation_Employee_Select.cfm" addtoken="No">
</CFIF>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists