Re: Calendar control by Jens
Jens
Thu Apr 21 14:27:25 CDT 2005
This is a multi-part message in MIME format.
------=_NextPart_000_001B_01C546B8.E98B1460
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
You can't address an ID directly. You must do it like this:
document.getelementbyid(Calender1).
Same goes for Calender2.
Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
> -----Original Message-----
> From: meg [mailto:asdf@asdf.com]
> Posted At: 21. april 2005 17:55
> Posted To: microsoft.public.frontpage.programming
> Conversation: Calendar control
> Subject: Calendar control
>
>
> I have a calendar control on my webpage, when I run it in
> preview it works, when i run it in IE I get the error
> "Calendar1 is undefined". Can someone help me figure out how
> to correctly use this control? Thanks.
>
> This is my code:
>
> <script language="JScript" runat="server">
> var oDate = new Date();
> Session("sMonth") = oDate.getMonth() + 1 + "/";
> Session("sDay") = oDate.getDate() + "/";
> Session("sYear") = oDate.getYear();
> </script>
> <script language=JScript>
> function ShowDate()
> {
> window.alert(Calendar1.Month + "/" + Calendar1.Day + "/" +
> Calendar1.Year + "\r\n" + Calendar2.Month + "/" +
> Calendar2.Day + "/" + Calendar2.Year); } </script> <table
> class=innertable>
> <tr height=20>
> <td>
> Select Starting Date:
> </td>
> <td>
> Select Ending Date:
> </td>
> </tr>
> <tr valign=top height=50>
> <td width=50>
> <OBJECT id=Calendar1 style="LEFT: 0px; TOP:
> 0px"classid=clsid:8E27C92B-1264-101C-8A2F-040224009C02
> VIEWASTEXT>
> <PARAM NAME="_Version" VALUE="524288">
> <PARAM NAME="_ExtentX" VALUE="6000">
> <PARAM NAME="_ExtentY" VALUE="4000">
> <PARAM NAME="_StockProps" VALUE="1">
> <PARAM NAME="BackColor" VALUE="16777215">
> <PARAM NAME="Year" VALUE="<%=Session("sYear")%>">
> <PARAM NAME="Month" VALUE="<%=Session("sMonth")%>">
> <PARAM NAME="Day" VALUE="<%=Session("sDay")%>">
> <PARAM NAME="DayLength" VALUE="1">
> <PARAM NAME="MonthLength" VALUE="1">
> <PARAM NAME="DayFontColor" VALUE="0">
> <PARAM NAME="FirstDay" VALUE="7">
> <PARAM NAME="GridCellEffect" VALUE="0">
> <PARAM NAME="GridFontColor" VALUE="10485760">
> <PARAM NAME="GridLinesColor" VALUE="10485760">
> <PARAM NAME="ShowDateSelectors" VALUE="-1">
> <PARAM NAME="ShowDays" VALUE="-1">
> <PARAM NAME="ShowHorizontalGrid" VALUE="-1">
> <PARAM NAME="ShowTitle" VALUE="-1">
> <PARAM NAME="ShowVerticalGrid" VALUE="0">
> <PARAM NAME="TitleFontColor" VALUE="10485760">
> <PARAM NAME="ValueIsNull" VALUE="0">
> </OBJECT>
> </td>
> <td>
> <OBJECT id=Calendar2 style="LEFT: 0px; TOP:
> 0px"classid=clsid:8E27C92B-1264-101C-8A2F-040224009C02
> VIEWASTEXT>
> <PARAM NAME="_Version" VALUE="524288">
> <PARAM NAME="_ExtentX" VALUE="6000">
> <PARAM NAME="_ExtentY" VALUE="4000">
> <PARAM NAME="_StockProps" VALUE="1">
> <PARAM NAME="BackColor" VALUE="16777215">
> <PARAM NAME="Year" VALUE="<%=Session("sYear")%>">
> <PARAM NAME="Month" VALUE="<%=Session("sMonth")%>">
> <PARAM NAME="Day" VALUE="<%=Session("sDay")%>">
> <PARAM NAME="DayLength" VALUE="1">
> <PARAM NAME="MonthLength" VALUE="1">
> <PARAM NAME="DayFontColor" VALUE="0">
> <PARAM NAME="FirstDay" VALUE="7">
> <PARAM NAME="GridCellEffect" VALUE="0">
> <PARAM NAME="GridFontColor" VALUE="10485760">
> <PARAM NAME="GridLinesColor" VALUE="10485760">
> <PARAM NAME="ShowDateSelectors" VALUE="-1">
> <PARAM NAME="ShowDays" VALUE="-1">
> <PARAM NAME="ShowHorizontalGrid" VALUE="-1">
> <PARAM NAME="ShowTitle" VALUE="-1">
> <PARAM NAME="ShowVerticalGrid" VALUE="0">
> <PARAM NAME="TitleFontColor" VALUE="10485760">
> <PARAM NAME="ValueIsNull" VALUE="0">
> </OBJECT>
> </td>
> </tr>
> <tr valign=top>
> <td>
> <input id=startdate name=startdate type=text value="mm/dd/yyyy">
> </td>
> <td>
> <input id=enddate name=enddate type=text value="mm/dd/yyyy">
> </td>
> </tr>
> <tr>
> <td><INPUT id="btnShow" type=button value=Button
> onclick="ShowDate();">
> </td>
> <td>
> </td>
> </tr>
> </table>
>
>
>
>
>
>
------=_NextPart_000_001B_01C546B8.E98B1460
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7036.0">
<TITLE>Re: Calendar control</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=3D2>You can't address an ID directly. You must do it like =
this:</FONT>
<BR><FONT SIZE=3D2>document.getelementbyid(Calender1).</FONT>
<BR><FONT SIZE=3D2>Same goes for Calender2. </FONT>
</P>
<P><FONT SIZE=3D2>Regards Jens Peter Karlsen. Microsoft MVP - =
Frontpage.</FONT>
</P>
<P><FONT SIZE=3D2>> -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>> From: meg [<A =
HREF=3D"mailto:asdf@asdf.com">mailto:asdf@asdf.com</A>] </FONT>
<BR><FONT SIZE=3D2>> Posted At: 21. april 2005 17:55</FONT>
<BR><FONT SIZE=3D2>> Posted To: =
microsoft.public.frontpage.programming</FONT>
<BR><FONT SIZE=3D2>> Conversation: Calendar control</FONT>
<BR><FONT SIZE=3D2>> Subject: Calendar control</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> I have a calendar control on my webpage, when I =
run it in </FONT>
<BR><FONT SIZE=3D2>> preview it works, when i run it in IE I get the =
error </FONT>
<BR><FONT SIZE=3D2>> "Calendar1 is undefined". Can =
someone help me figure out how </FONT>
<BR><FONT SIZE=3D2>> to correctly use this control? =
Thanks.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> This is my code:</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> <script language=3D"JScript" =
runat=3D"server"></FONT>
<BR><FONT SIZE=3D2>> var oDate =3D new Date();</FONT>
<BR><FONT SIZE=3D2>> Session("sMonth") =3D =
oDate.getMonth() + 1 + "/";</FONT>
<BR><FONT SIZE=3D2>> =
Session("sDay") =3D oDate.getDate() + =
"/";</FONT>
<BR><FONT SIZE=3D2>> Session("sYear") =3D =
oDate.getYear();</FONT>
<BR><FONT SIZE=3D2>> </script></FONT>
<BR><FONT SIZE=3D2>> <script language=3DJScript></FONT>
<BR><FONT SIZE=3D2>> function ShowDate()</FONT>
<BR><FONT SIZE=3D2>> {</FONT>
<BR><FONT SIZE=3D2>> window.alert(Calendar1.Month + =
"/" + Calendar1.Day + "/" + </FONT>
<BR><FONT SIZE=3D2>> Calendar1.Year + "\r\n" + =
Calendar2.Month + "/" + </FONT>
<BR><FONT SIZE=3D2>> Calendar2.Day + "/" + Calendar2.Year); =
} </script> <table </FONT>
<BR><FONT SIZE=3D2>> class=3Dinnertable></FONT>
<BR><FONT SIZE=3D2>> <tr height=3D20></FONT>
<BR><FONT SIZE=3D2>> <td></FONT>
<BR><FONT SIZE=3D2>> Select =
Starting Date:</FONT>
<BR><FONT SIZE=3D2>> </td></FONT>
<BR><FONT SIZE=3D2>> <td></FONT>
<BR><FONT SIZE=3D2>> Select =
Ending Date:</FONT>
<BR><FONT SIZE=3D2>> </td></FONT>
<BR><FONT SIZE=3D2>> </tr></FONT>
<BR><FONT SIZE=3D2>> <tr valign=3Dtop =
height=3D50></FONT>
<BR><FONT SIZE=3D2>> <td =
width=3D50></FONT>
<BR><FONT SIZE=3D2>> <OBJECT =
id=3DCalendar1 style=3D"LEFT: 0px; TOP: </FONT>
<BR><FONT SIZE=3D2>> =
0px"classid=3Dclsid:8E27C92B-1264-101C-8A2F-040224009C02</FONT>
<BR><FONT SIZE=3D2>> VIEWASTEXT></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"_Version" VALUE=3D"524288"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"_ExtentX" VALUE=3D"6000"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"_ExtentY" VALUE=3D"4000"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"_StockProps" VALUE=3D"1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"BackColor" VALUE=3D"16777215"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"Year" =
VALUE=3D"<%=3DSession("sYear")%>"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"Month" =
VALUE=3D"<%=3DSession("sMonth")%>"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"Day" =
VALUE=3D"<%=3DSession("sDay")%>"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"DayLength" VALUE=3D"1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"MonthLength" VALUE=3D"1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"DayFontColor" VALUE=3D"0"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"FirstDay" VALUE=3D"7"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"GridCellEffect" VALUE=3D"0"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"GridFontColor" VALUE=3D"10485760"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"GridLinesColor" =
VALUE=3D"10485760"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowDateSelectors" VALUE=3D"-1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowDays" VALUE=3D"-1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowHorizontalGrid" VALUE=3D"-1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowTitle" VALUE=3D"-1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowVerticalGrid" VALUE=3D"0"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"TitleFontColor" =
VALUE=3D"10485760"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ValueIsNull" VALUE=3D"0"></FONT>
<BR><FONT SIZE=3D2>> =
</OBJECT></FONT>
<BR><FONT SIZE=3D2>> </td></FONT>
<BR><FONT SIZE=3D2>> <td></FONT>
<BR><FONT SIZE=3D2>> <OBJECT =
id=3DCalendar2 style=3D"LEFT: 0px; TOP: </FONT>
<BR><FONT SIZE=3D2>> =
0px"classid=3Dclsid:8E27C92B-1264-101C-8A2F-040224009C02</FONT>
<BR><FONT SIZE=3D2>> VIEWASTEXT></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"_Version" VALUE=3D"524288"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"_ExtentX" VALUE=3D"6000"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"_ExtentY" VALUE=3D"4000"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"_StockProps" VALUE=3D"1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"BackColor" VALUE=3D"16777215"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"Year" =
VALUE=3D"<%=3DSession("sYear")%>"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"Month" =
VALUE=3D"<%=3DSession("sMonth")%>"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"Day" =
VALUE=3D"<%=3DSession("sDay")%>"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"DayLength" VALUE=3D"1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"MonthLength" VALUE=3D"1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"DayFontColor" VALUE=3D"0"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"FirstDay" VALUE=3D"7"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"GridCellEffect" VALUE=3D"0"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"GridFontColor" VALUE=3D"10485760"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"GridLinesColor" =
VALUE=3D"10485760"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowDateSelectors" VALUE=3D"-1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowDays" VALUE=3D"-1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowHorizontalGrid" VALUE=3D"-1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowTitle" VALUE=3D"-1"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ShowVerticalGrid" VALUE=3D"0"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"TitleFontColor" =
VALUE=3D"10485760"></FONT>
<BR><FONT SIZE=3D2>> <PARAM =
NAME=3D"ValueIsNull" VALUE=3D"0"></FONT>
<BR><FONT SIZE=3D2>> =
</OBJECT></FONT>
<BR><FONT SIZE=3D2>> </td></FONT>
<BR><FONT SIZE=3D2>> </tr></FONT>
<BR><FONT SIZE=3D2>> <tr valign=3Dtop></FONT>
<BR><FONT SIZE=3D2>> <td></FONT>
<BR><FONT SIZE=3D2>> <input =
id=3Dstartdate name=3Dstartdate type=3Dtext =
value=3D"mm/dd/yyyy"></FONT>
<BR><FONT SIZE=3D2>> </td></FONT>
<BR><FONT SIZE=3D2>> <td></FONT>
<BR><FONT SIZE=3D2>> <input =
id=3Denddate name=3Denddate type=3Dtext =
value=3D"mm/dd/yyyy"></FONT>
<BR><FONT SIZE=3D2>> </td></FONT>
<BR><FONT SIZE=3D2>> </tr></FONT>
<BR><FONT SIZE=3D2>> <tr></FONT>
<BR><FONT SIZE=3D2>> <td><INPUT =
id=3D"btnShow" type=3Dbutton value=3DButton </FONT>
<BR><FONT SIZE=3D2>> onclick=3D"ShowDate();"></FONT>
<BR><FONT SIZE=3D2>> </td></FONT>
<BR><FONT SIZE=3D2>> <td></FONT>
<BR><FONT SIZE=3D2>> </td></FONT>
<BR><FONT SIZE=3D2>> </tr></FONT>
<BR><FONT SIZE=3D2>> </table></FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
</P>
</BODY>
</HTML>
------=_NextPart_000_001B_01C546B8.E98B1460--