help finding cause of "Expected end of statement"
I'm hoping someone can help me find the source of error "Expected end of statement" I have determined that it is caused by a combination of code I've "borrowed" with my own. The code is for a popup calendar tool which lets the user select a date on a visual calendar and then takes their date and populates a form field with it. I have used the code successfully in another application so I know it works. My app worked fine until I but the code in. The calendar works in my code, it's just that it throws an ugly runtime error message.
I will copy here, the calendar code that I insert as an include file, along with my asp page code down to the line which the debugger points to (in bold). If I take out either the calendar code, or the last line I'll put here, the error is not thrown. That leaves me to believe it's lies somewhere in between. I have looked for missing or extra quotes and have looked for ends to conditional statements. Can't find it.
I'd appreciate anyone's help.
THE CALENDAR CODE:
<script language=vbscript>
function mlookup(mnt)
select case mnt
case 1 mlookup="J A N"
case 2 mlookup="F E B"
case 3 mlookup="M A R"
case 4 mlookup="A P R"
case 5 mlookup="M A Y"
case 6 mlookup="J U N"
case 7 mlookup="J U L"
case 8 mlookup="A U G"
case 9 mlookup="S E P"
case 10 mlookup="O C T"
case 11 mlookup="N O V"
case 12 mlookup="D E C"
end select
end function
function mlookup2(mnt)
select case mnt
case 1 mlookup2="January"
case 2 mlookup2="February"
case 3 mlookup2="March"
case 4 mlookup2="April"
case 5 mlookup2="May"
case 6 mlookup2="June"
case 7 mlookup2="July"
case 8 mlookup2="August"
case 9 mlookup2="September"
case 10 mlookup2="October"
case 11 mlookup2="November"
case 12 mlookup2="December"
end select
end function
function yformat(yyr)
for a=1 to len(yyr)
b=b+mid(yyr,a,1)+" "
next
yformat=mid(b,1,len(b)-1)
end function
function dlookup(mm, yy)
dlookup=31
if mm<8 and mm/2=fix(mm/2) then dlookup=30
if mm>7 and mm/2<>fix(mm/2) then dlookup=30
if mm=2 then
lpyr=leapyear(yy)
if lpyr=1 then dlookup=29
if lpyr=0 then dlookup=28
end if
end function
function leapyear(yyr)
leapyear=0
if yyr/4=fix(yyr/4) then leapyear=1
if yyr/100=fix(yyr/100) then leapyear=0
if yyr/400=fix(yyr/400) then leapyear=1
end function
function namedate2(mmddyy)
ddate=mmddyy
yys=mid(ddate,1,4)
mms=mid(ddate,5,2)
dds=mid(ddate,7,2) * 1
ndate=mlookup2(mms) & " " & dds & ", " & yys
namedate2=ndate
end function
sub init()
document.all.mm.value=month(now())
document.all.yy.value=year(now())
document.all.dd.value=day(now())
call pcalendar()
end sub
sub pcalendar()
mnt=document.all.mm.value
yyr=document.all.yy.value
ddy=document.all.dd.value
fday=weekday(mnt & "/1/" & yyr)
lday=dlookup(mnt, yyr)
innerHTML=" " & mlookup(mnt) & " " & yformat(yyr) & " "
document.all.my.innerHTML=innerHTML
innerHTML=" " & yformat(yyr) & " "
document.all.y.innerHTML=innerHTML
for a=1 to 6 ' six weeks
for b=1 to 7 ' seven days
c=c+1
if c>=fday then
d=d+1
else
d=0
end if
targetId=a & b
if d<=lday then
if d=day(now()) and int(mnt)=month(now()) and int(yyr)=year(now()) then
innerHTML=" " & d & " "
if d=0 then innerHTML=""
document.all(targetId).innerHTML=innerHTML
else
document.all(targetId).innerHTML=""
end if
next
fday=1
next
end sub
sub prevyr()
showpcmonth()
document.all.yy.value=document.all.yy.value-1
call pcalendar()
end sub
sub nextyr()
showpcmonth()
document.all.yy.value=document.all.yy.value+1
call pcalendar()
end sub
sub prevmo()
showpcal()
document.all.mm.value=document.all.mm.value-1
if document.all.mm.value=0 then
document.all.mm.value=12
document.all.yy.value=document.all.yy.value-1
end if
call pcalendar()
end sub
sub nextmo()
showpcal()
document.all.mm.value=document.all.mm.value+1
if document.all.mm.value=13 then
document.all.mm.value=1
document.all.yy.value=document.all.yy.value+1
end if
call pcalendar()
end sub
sub outday(dd)
mms=document.all.mm.value
yys=document.all.yy.value
dds=document.all.dd.value
dout=yys & right("0" & mms, 2) & right ("0" & dd,2)
dout= mms & "/" & dd & "/" & yys
dtgo=document.all.cinput.value
document.all(dtgo).value=dout
call hidePCal()
end sub
sub showPCalE(ddd)
ddate=document.all(ddd).value
yys=year(ddate)
mms=month(ddate)
dds=day(ddate)
if yys-document.all("yy").value<>0 or mms-document.all("mm").value<>0 then
document.all("yy").value=yys
document.all("mm").value=mms
pcalendar()
end if
showPCal()
document.all("cinput").value=ddd
end sub
sub cmonth(mnt)
document.all.mm.value=mnt
hidePCmonth()
call pcalendar()
end sub
sub showPCmonth()
document.all("pcmonth").style.display=""
end sub
sub hidePCmonth()
showpcal()
document.all("pcmonth").style.display="none"
end sub
sub showPCal()
document.all("ppcalendar").style.display=""
end sub
sub hidePCal()
document.all("ppcalendar").style.display="none"
document.all("pcmonth").style.display="none"
end sub
</script>
Month Year
" onclick="java script: nextmo()" id=button2 name=button2>
Su
Mo
Tu
We
Th
Fr
Sa
Month Year
' onclick="java script: nextyr()" id=button4 name=button4>
Select a month
<script language=vbscript>
sub ck(xt)
k=document.all(xt).value
document.all(xt).value=formatdatetime("11/12/1999",2)
end sub
</script>
-----------------------------------------------------
MY PAGE CODE (down to the line that the debugger points to):
<?php
@language=vbscript
?>
<?php
option explicit
?>
CASIS Authorization Form
TABLE.cal { COLOR: #c0c0c0; WIDTH: 200px }
TD.cal { FONT-FAMILY: verdana; FONT-SIZE:8pt; TEXT-ALIGN: center }
INPUT.cal { COLOR: white; BACKGROUND: black; BORDER: none; WIDTH: 20 }
A { TEXT-DECORATION: none; FONT-FAMILY: verdana;}
A.cal:link { COLOR: white; }
A.cal:visited { COLOR: white; }
A.cal:active { COLOR: white; }
A.cal:hover { COLOR: gray; }
A.tdy:link { COLOR: #c5f9c5; }
A.tdy:visited { COLOR: #c5f9c5; }
A.tdy:active { COLOR: white; }
A.tdy:hover { COLOR: gray; }
A.tdz:link { COLOR: yellow; FONT-WEIGHT: bold; }
A.tdz:visited { COLOR: yellow; FONT-WEIGHT: bold; }
#ppcalendar { LEFT: 110px; POSITION: absolute; TOP: 100px; }
#pcmonth { LEFT: 110px; POSITION: absolute; TOP: 100px ;}
<script language="javascript">
"9")
{
alert("You have entered a non-numeric character in the Case Number field. Please re-enter.");
document.casenum.case_num.focus();
return false;
}
}
return true;
}
function openWin( windowURL, windowName, windowFeatures )
{
return window.open( windowURL, windowName, windowFeatures ) ;
}
//-->
</script>
<script language="javascript">
</script>
Case Manager
Name:
<?php
=session("staffName")
?>
RU #:
<?php
=session("ruNumber")
?>
Worker #:
<?php
=session("workerNum")
?>
Region:
<?php
=session("region")
?>
Authorizing Agency:
<?php
=session("agency")
?>
Peter J. Boettcher posted this at 13:07 — 8th April 2002.
They have: 812 posts
Joined: Feb 2000
I noticed that you're missing an "End If" for the "if d<=lday then" if statement in the pcalendar sub.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.