Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "9/31/2004"]'
is the error I am getting. I tried using datavalue and cdate to change the concatated string to a date. All of the functions are included below.
**** code below ****
<% @LANGUAGE = "VBScript" %>
<% Response.Buffer = True %>
<html>
<style>
<!--
.onMonth{ width: 150px; cursor: pointer; }
.onDay{ width: 150px; background-color: #5555ff; color: #ffffff; cursor: pointer; }
.offMonth{ width: 150px; background-color: #cccccc; cursor: pointer; }
.whiteText{ color: #ffffff; font-weight: 600;}
-->
</style>
<body>
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<form id="calendar" name="calendar" method="post" action="calendar.asp">
<td width="240" height="100%">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="1">
<tr><td></td></tr>
</table>
</td>
<td height="100%">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><% call monthDropDown() %></td>
<td> </td>
<td><% call yearDropDown() %></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="100%">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="1">
<%call writeWeekdayNames()%><%call largeCalendar()%>
</table>
</td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>
</html>
<%sub monthDropDown()%>
<select id="monthDropDown" name="monthDropDown" value="<%=month(now)%>" onkeypress="if(event.keyCode==13) document.calendar.submit();">
<%dim pValue
if request.form("monthDropDown")>"" then
pValue=request.form("monthDropDown")
else
pValue=month(now)
end if
%>
<% for count = 1 to 12 %>
<% if(pValue=count) then %>
<option value="<%=count%>" selected><%=monthname(count)%></option>
<% else %>
<option value="<%=count%>"><%=monthname(count)%></option>
<% end if %>
<% next %>
</select>
<%end sub%>
<%sub yearDropDown()%>
<select id="yearDropDown" name="yearDropDown" value="<%=year(now)%>" onkeypress="if(event.keyCode==13) document.calendar.submit();">
<%dim pValue
if request.form("yearDropDown")>"" then
pValue=request.form("yearDropDown")
else
pValue=year(now)
end if
%>
<% for count = year(now) - 20 to year(now) + 20 %>
<% if(pValue=count) then %>
<option value="<%=count%>" selected><%=count%></option>
<% else %>
<option value="<%=count%>"><%=count%></option>
<% end if %>
<% next %>
</select>
<%end sub%>
<%sub writeWeekdayNames()%>
<% for count = 1 to 7 %>
<td class="day" height="1"><%=weekdayname(count,true)%></td>
<% next %>
<%response.write vbCrLf%>
<%end sub%>
<% sub offMonth_Day(pValue) %>
<td class="offMonth">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<% if (pValue>15) then %>
<tr><td width="100%" height="100%" onclick="alert('<%=formatOffMonthDate(pValue,-1)%>');"></td></tr>
<tr><td width="100%" align="right" onclick="alert('<%=formatOffMonthDate(pValue,-1)%>');"><%=pValue%></td></tr>
<% else %>
<tr><td width="100%" height="100%" onclick="alert('<%=formatOffMonthDate(pValue,1)%>');"></td></tr>
<tr><td width="100%" align="right" onclick="alert('<%=formatOffMonthDate(pValue,1)%>');"><%=pValue%></td></tr>
<% end if %>
</table>
</td>
<% end sub %>
<%sub onMonth_Day(pValue)%>
<%if date=formatDate(pValue) then%>
<td class="onDay">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td width="100%" height="100%" class="whiteText" onclick="alert('<%=formatDate(pValue)%>');"></td></tr>
<tr><td width="100%" align="right" class="whiteText" onclick="alert('<%=formatDate(pValue)%>');"><%=pValue%></td></tr>
</table>
</td>
<%else%>
<td class="onMonth">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td width="100%" height="100%" onclick="alert('<%=formatDate(pValue)%>');"></td></tr>
<tr><td width="100%" align="right" onclick="alert('<%=formatDate(pValue)%>');"><%=pValue%></td></tr>
</table>
</td>
<%end if%>
<%end sub%>
<% sub beginRow() %>
<tr>
<% end sub %>
<% sub endRow() %>
</tr>
<% end sub %>
<%
function formatOffMonthDate(pValue,pModifier)
if request.form("monthDropDown")>"" then
lvMonth=request.form("monthDropDown")
else
lvMonth=month(now)
end if
if request.form("yearDropDown")>"" then
lvYear=request.form("yearDropDown")
else
lvYear=year(now)
end if
formatOffMonthDate=dateadd("m", pModifier,lvMonth & "/" & pValue & "/" & lvYear)
end function
function formatDate(pValue)
if request.form("monthDropDown")>"" then
vMonth=request.form("monthDropDown")
else
vMonth=month(now)
end if
if request.form("yearDropDown")>"" then
vYear=request.form("yearDropDown")
else
vYear=year(now)
end if
formatDate=vMonth & "/" & pValue & "/" & vYear
end function
function LC_writeMonth(count,pValue1,pValue2,monthState)
response.write vbCrLf
for maketable=pValue1 to pValue2
select case count
case 1
call beginRow()
if monthState=false then
call offMonth_Day(maketable)
else
call onMonth_Day(maketable)
end if
count=count+1
case 7
if monthState=false then
call offMonth_Day(maketable)
else
call onMonth_Day(maketable)
end if
call endRow()
count=1
case else
if monthState=false then
call offMonth_Day(maketable)
else
call onMonth_Day(maketable)
end if
count=count+1
end select
next
LC_writeMonth=count
end function
sub largeCalendar()
dim pValue
if request.form("monthDropDown")>"" or request.form("yearDropDown")>"" then
pValue=request.form("monthDropDown") & "/1/" & request.form("yearDropDown")
else
pValue=date
end if
dim daysLastMonth
dim daysThisMonth: daysThisMonth=daysInMonth(month(pValue))
dim daysNextMonth
if month(pValue)-1=0 then
daysLastMonth=daysInMonth(12)
else
daysLastMonth=daysInMonth(month(pValue)-1)
end if
if month(pValue)+1=13 then
daysNextMonth=daysInMonth(1)
else
daysNextMonth=daysInMonth(month(pValue)+1)
end if
dim numDaysLastMonth: numDaysLastMonth=weekday(datevalue(month(pValue) & "/1/" & year(pValue)))+5
dim numDaysNextMonth: numDaysNextMonth=48-(daysThisMonth + numDaysLastMonth)
dim count: count=1
response.write vbCrLf
count=LC_writeMonth(count,daysLastMonth-numDaysLastMonth,daysLastMonth,false)
count=LC_writeMonth(count,1,daysThisMonth,true)
call LC_writeMonth(count,1,numDaysNextMonth,false)
response.write vbCrLf
end sub
function daysInMonth(pValue)
select case pValue
case 1,3,5,7,8,10,12:
daysInMonth = 31
case 2:
if (iYear mod 4 = 0) and ((iYear mod 100 <> 0) or (iYear mod 400 = 0)) then
daysInMonth = 29
else
daysInMonth = 28
end if
case 4,6,9,11:
daysInMonth = 30
end select
end function
%>
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "9/31/2004"]'
is the error I am getting. I tried using datavalue and cdate to change the concatated string to a date. All of the functions are included below.
**** code below ****
<% @LANGUAGE = "VBScript" %>
<% Response.Buffer = True %>
<html>
<style>
<!--
.onMonth{ width: 150px; cursor: pointer; }
.onDay{ width: 150px; background-color: #5555ff; color: #ffffff; cursor: pointer; }
.offMonth{ width: 150px; background-color: #cccccc; cursor: pointer; }
.whiteText{ color: #ffffff; font-weight: 600;}
-->
</style>
<body>
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<form id="calendar" name="calendar" method="post" action="calendar.asp">
<td width="240" height="100%">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="1">
<tr><td></td></tr>
</table>
</td>
<td height="100%">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><% call monthDropDown() %></td>
<td> </td>
<td><% call yearDropDown() %></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="100%">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="1">
<%call writeWeekdayNames()%><%call largeCalendar()%>
</table>
</td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>
</html>
<%sub monthDropDown()%>
<select id="monthDropDown" name="monthDropDown" value="<%=month(now)%>" onkeypress="if(event.keyCode==13) document.calendar.submit();">
<%dim pValue
if request.form("monthDropDown")>"" then
pValue=request.form("monthDropDown")
else
pValue=month(now)
end if
%>
<% for count = 1 to 12 %>
<% if(pValue=count) then %>
<option value="<%=count%>" selected><%=monthname(count)%></option>
<% else %>
<option value="<%=count%>"><%=monthname(count)%></option>
<% end if %>
<% next %>
</select>
<%end sub%>
<%sub yearDropDown()%>
<select id="yearDropDown" name="yearDropDown" value="<%=year(now)%>" onkeypress="if(event.keyCode==13) document.calendar.submit();">
<%dim pValue
if request.form("yearDropDown")>"" then
pValue=request.form("yearDropDown")
else
pValue=year(now)
end if
%>
<% for count = year(now) - 20 to year(now) + 20 %>
<% if(pValue=count) then %>
<option value="<%=count%>" selected><%=count%></option>
<% else %>
<option value="<%=count%>"><%=count%></option>
<% end if %>
<% next %>
</select>
<%end sub%>
<%sub writeWeekdayNames()%>
<% for count = 1 to 7 %>
<td class="day" height="1"><%=weekdayname(count,true)%></td>
<% next %>
<%response.write vbCrLf%>
<%end sub%>
<% sub offMonth_Day(pValue) %>
<td class="offMonth">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<% if (pValue>15) then %>
<tr><td width="100%" height="100%" onclick="alert('<%=formatOffMonthDate(pValue,-1)%>');"></td></tr>
<tr><td width="100%" align="right" onclick="alert('<%=formatOffMonthDate(pValue,-1)%>');"><%=pValue%></td></tr>
<% else %>
<tr><td width="100%" height="100%" onclick="alert('<%=formatOffMonthDate(pValue,1)%>');"></td></tr>
<tr><td width="100%" align="right" onclick="alert('<%=formatOffMonthDate(pValue,1)%>');"><%=pValue%></td></tr>
<% end if %>
</table>
</td>
<% end sub %>
<%sub onMonth_Day(pValue)%>
<%if date=formatDate(pValue) then%>
<td class="onDay">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td width="100%" height="100%" class="whiteText" onclick="alert('<%=formatDate(pValue)%>');"></td></tr>
<tr><td width="100%" align="right" class="whiteText" onclick="alert('<%=formatDate(pValue)%>');"><%=pValue%></td></tr>
</table>
</td>
<%else%>
<td class="onMonth">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td width="100%" height="100%" onclick="alert('<%=formatDate(pValue)%>');"></td></tr>
<tr><td width="100%" align="right" onclick="alert('<%=formatDate(pValue)%>');"><%=pValue%></td></tr>
</table>
</td>
<%end if%>
<%end sub%>
<% sub beginRow() %>
<tr>
<% end sub %>
<% sub endRow() %>
</tr>
<% end sub %>
<%
function formatOffMonthDate(pValue,pModifier)
if request.form("monthDropDown")>"" then
lvMonth=request.form("monthDropDown")
else
lvMonth=month(now)
end if
if request.form("yearDropDown")>"" then
lvYear=request.form("yearDropDown")
else
lvYear=year(now)
end if
formatOffMonthDate=dateadd("m", pModifier,lvMonth & "/" & pValue & "/" & lvYear)
end function
function formatDate(pValue)
if request.form("monthDropDown")>"" then
vMonth=request.form("monthDropDown")
else
vMonth=month(now)
end if
if request.form("yearDropDown")>"" then
vYear=request.form("yearDropDown")
else
vYear=year(now)
end if
formatDate=vMonth & "/" & pValue & "/" & vYear
end function
function LC_writeMonth(count,pValue1,pValue2,monthState)
response.write vbCrLf
for maketable=pValue1 to pValue2
select case count
case 1
call beginRow()
if monthState=false then
call offMonth_Day(maketable)
else
call onMonth_Day(maketable)
end if
count=count+1
case 7
if monthState=false then
call offMonth_Day(maketable)
else
call onMonth_Day(maketable)
end if
call endRow()
count=1
case else
if monthState=false then
call offMonth_Day(maketable)
else
call onMonth_Day(maketable)
end if
count=count+1
end select
next
LC_writeMonth=count
end function
sub largeCalendar()
dim pValue
if request.form("monthDropDown")>"" or request.form("yearDropDown")>"" then
pValue=request.form("monthDropDown") & "/1/" & request.form("yearDropDown")
else
pValue=date
end if
dim daysLastMonth
dim daysThisMonth: daysThisMonth=daysInMonth(month(pValue))
dim daysNextMonth
if month(pValue)-1=0 then
daysLastMonth=daysInMonth(12)
else
daysLastMonth=daysInMonth(month(pValue)-1)
end if
if month(pValue)+1=13 then
daysNextMonth=daysInMonth(1)
else
daysNextMonth=daysInMonth(month(pValue)+1)
end if
dim numDaysLastMonth: numDaysLastMonth=weekday(datevalue(month(pValue) & "/1/" & year(pValue)))+5
dim numDaysNextMonth: numDaysNextMonth=48-(daysThisMonth + numDaysLastMonth)
dim count: count=1
response.write vbCrLf
count=LC_writeMonth(count,daysLastMonth-numDaysLastMonth,daysLastMonth,false)
count=LC_writeMonth(count,1,daysThisMonth,true)
call LC_writeMonth(count,1,numDaysNextMonth,false)
response.write vbCrLf
end sub
function daysInMonth(pValue)
select case pValue
case 1,3,5,7,8,10,12:
daysInMonth = 31
case 2:
if (iYear mod 4 = 0) and ((iYear mod 100 <> 0) or (iYear mod 400 = 0)) then
daysInMonth = 29
else
daysInMonth = 28
end if
case 4,6,9,11:
daysInMonth = 30
end select
end function
%>