I'm having the following problem:
My main webpage calls a function stored in a .js file that creates an HTML window to display a calendar. Whenever I click on a date in that calendar,
the calendar should return to the main webpage, but it cannot find the home window again. I'm getting this error:
Microsoft JScript runtime error: 'self.opener.document.idFormMain.txtPeriodOfOperat ionEff' is null or not an object
I've successfully used this before, but I'm at a loss why it's not working here.
I've included relevant parts the source code that I'm using as follows:
Part <A> is a section of the HTML in my main webpage that creates the Calendar Window.
Part <B> is a javascript function at the bottom of the main HTML page that's called from the highlighted line in <A>
Part <C> is the HTML of the Calendar Window that is created by calendar.js
For copyright reasons (i.e. I don't own it), I'm afraid I can't include the source for calendar.js.
Can anyone help me?
Thanks much in advance.
Expand|Select|Wrap|Line Numbers
- =================================BEGIN Part A=================================
- <script src='calender.js' type='text/javascript'></script>
- <!-- Begin Main (Right-Side, Bottom) -->
- <tr valign='top' style='height: 184px'>
- <td align='center' valign='top' style='font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: bold; color: #000000; padding: 0px;'>
- <span id="spnForm" runat="server" />
- <form id='idFormMain' method='post'>
- <hr size='1' style='color: #808000; border-top-style: solid; border-right-style: solid; border-left-style: solid; border-bottom-style: solid;' noshade/>
- <!-- Master Data Input Table -->
- <table id='idtblMasterDataInput' style='width: 720px;' border='0' cellpadding='0' cellspacing='0'>
- <!-- Row 3 of Master Data Input Table -->
- <tr>
- <td align='left' valign='middle' style='width: 100%; padding-right: 0px; padding-left: 0px; font-size: 11px; padding-bottom: 0px; color: #000000; padding-top: 0px; font-family: tahoma,verdana,arial,sans-serif; background-color: #ffffff; border-bottom-width: 1px; border-bottom-color: #d1b172;'>
- <!-- Container Table for Row 3 of Master Data Input Table -->
- <table id='idtblMasterDataInputRow3' style='width: 100%;' border='0' cellpadding='0' cellspacing='0'>
- <tr>
- <td align='left' valign='middle' style='width: 30%'>
- <!-- Effective Date Input Subtable -->
- <table id='idtblPeriodOfOperationEff' style='width: 100%;' border='0' cellpadding='0' cellspacing='0'>
- <tr>
- <td align='left' valign='middle' style='width: 33%; padding-right: 0px; padding-left: 6px; font-size: 11px; padding-bottom: 0px; color: #000000; padding-top: 1px; font-family: tahoma,verdana,arial,san-serif; background-color: #ffffff;'>
- Effective Date:
- </td>
- <td align='left' valign='middle' style='width: 47%; padding-right: 0px; padding-left: 6px; font-size: 11px; padding-bottom: 0px; color: #000000; padding-top: 1px; font-family: tahoma,verdana,arial,sans-serif; background-color: #ffffff;'>
- <input type='text' id='txtPeriodOfOperationEff' name='txtPeriodOfOperationEff' maxlength='10' runat='server' style='padding-right: 0px; padding-left: 6px; font-size: 11px; padding-bottom: 0px; text-transform: uppercase; width: 90%; color: #000000; padding-top: 1px; font-family: tahoma,verdana,arial,sans-serif; background-color: #ffffff;' />
- </td>
- <td align='left' valign='middle' style='width: 20%; padding-right: 0px; padding-left: 6px; font-size: 11px; padding-bottom: 0px; color: #000000; padding-top: 1px; font-family: tahoma,verdana,arial,sans-serif; background-color: #ffffff;'>
- <img border='0' src='/img/calendar1.gif' onclick="javascript:pop_cal('txtPeriodOfOperationEff')" width="16" height="16"/>
- </td>
- </tr>
- </table>
- </td>
- <td align='left' valign='middle' style='width: 30%'>
- <!-- Discontinue Date Input Subtable -->
- <table id='idtblPeriodOfOperationDisc' style='width: 100%;' border='0' cellpadding='0' cellspacing='0'>
- <tr>
- <td align='left' valign='middle' style='width: 36%; padding-right: 0px; padding-left: 6px; font-size: 11px; padding-bottom: 0px; color: #000000; padding-top: 1px; font-family: tahoma,verdana,arial,san-serif; background-color: #ffffff;'>
- Discontinue Date:
- </td>
- <td align='left' valign='middle' style='width: 44%; padding-right: 0px; padding-left: 6px; font-size: 11px; padding-bottom: 0px; color: #000000; padding-top: 1px; font-family: tahoma,verdana,arial,sans-serif; background-color: #ffffff;'>
- <input type='text' id='txtPeriodOfOperationDisc' name='txtPeriodOfOperationDisc' maxlength='10' runat='server' style='padding-right: 0px; padding-left: 6px; font-size: 11px; padding-bottom: 0px; text-transform: uppercase; width: 90%; color: #000000; padding-top: 1px; font-family: tahoma,verdana,arial,sans-serif; background-color: #ffffff;' />
- </td>
- <td align='left' valign='middle' style='width: 20%; padding-right: 0px; padding-left: 6px; font-size: 11px; padding-bottom: 0px; color: #000000; padding-top: 1px; font-family: tahoma,verdana,arial,sans-serif; background-color: #ffffff;'>
- <img border='0' src='/img/calendar1.gif' onclick="javascript:pop_cal('txtPeriodOfOperationDisc')" width="16" height="16"/>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </form>
- </td>
- </tr>
- ==================================END Part A==================================
Expand|Select|Wrap|Line Numbers
- =================================BEGIN Part B=================================
- <script type="text/javascript">
- function pop_cal(ival)
- {
- show_calendar('idFormMain.' + ival); // show_calendar() is a function within calendar.js
- }
- </script>
- ==================================END Part B==================================
- =================================BEGIN Part C=================================
- <html>
- <head><title>Calendar</title>
- </head>
- <body BGCOLOR='#FFFFFF' link="black" vlink="black" alink="black" text="black" STYLE="font-family: tahoma,verdana,arial,sans-serif; font-size: 1px; font-weight: normal; color: #000000;">
- <CENTER><FONT STYLE="font-family: tahoma,verdana,arial,sans-serif; font-size: 13px; font-weight: bold; color: #000000;">May 2007</FONT></CENTER><TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#F0F0F0' BORDERCOLOR='#000000' STYLE='width: 230px; font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: normal; color: #000000; border-collapse: collapse;'><TR><TD ALIGN=center valign=bottom style='height:20px;'>
- <A HREF="javascript:window.opener.Build('idFormMain.txtPeriodOfOperationEff', '4', '2006', 'MM/DD/YYYY');"> <img src='/img/nav_begin.gif' border=0> </A></TD><TD ALIGN=center VALIGN=bottom>
- <A HREF="javascript:window.opener.Build('idFormMain.txtPeriodOfOperationEff', '3', '2007', 'MM/DD/YYYY');"> <img src='/img/nav_prev.gif' border=0> </A></TD><TD ALIGN=center VALIGN=bottom>
- <A HREF="javascript:window.opener.Build('idFormMain.txtPeriodOfOperationEff', '5', '2007', 'MM/DD/YYYY');"> <img src='/img/nav_next.gif' border=0> </A></TD><TD ALIGN=center VALIGN=bottom>
- <A HREF="javascript:window.opener.Build('idFormMain.txtPeriodOfOperationEff', '4', '2008', 'MM/DD/YYYY');"> <img src='/img/nav_end.gif' border=0> </A></TD></TR></TABLE><BR>
- <TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0' BORDERCOLOR='#000099' STYLE='width: 230px; font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: normal; color: #000000; border-collapse: collapse;'><TR><TD ALIGN='CENTER' VALIGN='MIDDLE' WIDTH='14%' STYLE='height: 20px; font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: bold; color: #FFFFFF; background-color: #000099;'>S</TD><TD ALIGN='CENTER' VALIGN='MIDDLE' WIDTH='14%' STYLE='height: 20px; font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: bold; color: #FFFFFF; background-color: #000099;'>M</TD><TD ALIGN='CENTER' VALIGN='MIDDLE' WIDTH='14%' STYLE='height: 20px; font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: bold; color: #FFFFFF; background-color: #000099;'>T</TD><TD ALIGN='CENTER' VALIGN='MIDDLE' WIDTH='14%' STYLE='height: 20px; font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: bold; color: #FFFFFF; background-color: #000099;'>W</TD><TD ALIGN='CENTER' VALIGN='MIDDLE' WIDTH='14%' STYLE='height: 20px; font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: bold; color: #FFFFFF; background-color: #000099;'>T</TD><TD ALIGN='CENTER' VALIGN='MIDDLE' WIDTH='14%' STYLE='height: 20px; font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: bold; color: #FFFFFF; background-color: #000099;'>F</TD><TD ALIGN='CENTER' VALIGN='MIDDLE' WIDTH='16%' STYLE='height: 20px; font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: bold; color: #FFFFFF; background-color: #000099;'>S</TD></TR><TR><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana'> </FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'> </FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/01/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">1</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/02/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">2</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/03/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">3</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/04/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">4</A></FONT></TD><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/05/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">5</A></FONT></TD></TR><TR><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/06/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">6</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/07/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">7</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/08/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">8</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/09/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">9</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/10/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">10</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/11/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">11</A></FONT></TD><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/12/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">12</A></FONT></TD><TR><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/13/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">13</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/14/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">14</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/15/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">15</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/16/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">16</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/17/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">17</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/18/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();"><FONT COLOR="RED"><B>18</B></FONT></A></FONT></TD><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/19/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">19</A></FONT></TD><TR><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/20/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">20</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/21/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">21</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/22/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">22</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/23/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">23</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/24/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">24</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/25/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">25</A></FONT></TD><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/26/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">26</A></FONT></TD><TR><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/27/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">27</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/28/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">28</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/29/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">29</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/30/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">30</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana'><A HREF='#' onClick="self.opener.document.idFormMain.txtPeriodOfOperationEff.value='05/31/2007';self.opener.document.idFormMain.txtPeriodOfOperationEff.focus();window.close();">31</A></FONT></TD><TD WIDTH='14%'><FONT SIZE='2' FACE='Verdana' COLOR='gray'>1</FONT></TD><TD WIDTH='14%' BGCOLOR="#E0E0C0"><FONT SIZE='2' FACE='Verdana' COLOR='gray'>2</FONT></TD></TABLE>
- <CENTER><FONT STYLE="font-family: tahoma,verdana,arial,sans-serif; font-size: 11px; font-weight: normal; color: #000000;">[ <A HREF="javascript:window.close();">Close Calendar</A> ]</FONT></CENTER>
- </font></body></html>
- ==================================END Part C==================================