Javascript error in asp.net
<p>I have a calendar control that is hosted on an iframe. I get a javascript error when I click on a date on the calendar. <strong>window.top.document.getElementById(..) is null or not an object</strong>  </p>

<p>The iframe is hosted on another page ConfigSettings.aspx  </p>

<p>The code in the calendar control code behind is:  </p>

<pre><code>Dim sjscript As String = "&lt;script language=""javascript"" type=""text/javascript""&gt;"
sjscript &amp;= "window.top.document.getElementById('" &amp; HttpContext.Current.Request.QueryString("DateTextID") &amp; "').value = '" &amp; Calendar1.SelectedDate &amp; "';"
sjscript &amp;= "window.top.document.getElementById('" &amp; HttpContext.Current.Request.QueryString("DateTextID") &amp; "1').style.display = 'none';"
sjscript = sjscript &amp; "&lt;/script" &amp; "&gt;"
Literal1.Text = sjscript  
</code></pre>

<p>The html code is:  </p>

<pre><code>&lt;input type="text" class="TextBox" id="ToDate" runat="server"/&gt;
    &lt;a href="javascript:ShowCalendar('ToDate1')"&gt;&lt;img src="images/Calendar.jpg" border="0" /&gt;&lt;/a&gt;
                    &lt;iframe src="Calendar.aspx?DateTextID=ToDate" style="display:none; width:200px; height:100px" name="ToDate1" id="ToDate1"&gt;&lt;/iframe&gt;
&lt;asp:Label runat="server" ID="lblEndTime" Text="End Time:"&gt;&lt;/asp:Label&gt;
</code></pre>

<p>What would be causing the error?</p>
