- 전체
- HTML
- Web Design (웹디자인)
- XE 응용 개발
- wordpress plugin dev
- Javascript & JavaScript Application
- MEAN Stack : full stack javascript
- angular js & ionic framework
- bootstrap
- WebGL, Three.js and Babylon.js
- restful api design
- mobile web
- node.js 응용
- Cloud Service 응용
- 웹 어셈블리 개발 [WASM, WebAssembly]
- 마이크로서비스, MSA (microservice architecture)
- WebGL / WebGPU
- next.js 개발
- micro frontend (마이크로프론트앤드)
- 전자상거래/쇼핑몰
- 서버 클라우드 (aws, azure, google)
HTML [HTML] Javascript error: 'window.top.document.getElementById(...)' is null or not an object
2024.05.20 15:39
[HTML] Javascript error: 'window.top.document.getElementById(...)' is null or not an object
I am getting a javascript error when I attempt to click on my calendar control.
The html code is:
<td align="left" style="width:50%;"><asp:Label runat="server" CssClass="TextFontBold" ID="lblStartDate" Text="Start Date:"></asp:Label>
<input type="text" class="TextBox" id="FromDate" runat="server"/><a href="javascript:ShowCalendar('FromDate1')"><img src="images/Calendar.png" border="0" /></a>
<iframe src="Calendar.aspx?DateTextID=FromDate" style="display:none; top: 0px; left: 0px; width:245px; height:164px" frameborder="0" scrolling="no" name="FromDate1" id="FromDate1"></iframe>
<asp:Label runat="server" CssClass="TextFontBold" ID="lblPromoStartTime" Text="Start Time:"></asp:Label>
</td>
When I click on a date in the calendar control, this code is executed on the code-behind:
Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
Dim strjscript As String = "<script language=""javascript"" type=""text/javascript"">"
strjscript &= "window.top.document.getElementById('" & HttpContext.Current.Request.QueryString("DateTextID") & "').value = '" & Calendar1.SelectedDate & "';"
strjscript &= "window.top.document.getElementById('" & HttpContext.Current.Request.QueryString("DateTextID") & "1').style.display = 'none';"
strjscript = strjscript & "</script" & ">"
Literal1.Text = strjscript
End Sub
The error I am getting is 'window.top.document.getElementById(...)' is null or not an object
I do have an object called FromDate.
What else could be causing this error?
Try window.parent.document.getElementById() instead of window.top.document.getElementById()
[출처] https://stackoverflow.com/questions/7353847/javascript-error-window-top-document-getelementbyid-is-null-or-not-an-ob
본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 4 |
[Node.js] forever - node.js app 이 죽을경우 자동으로 재실행해주는 모듈
| 졸리운_곰 | 2017.09.26 | 635 |
| 3 |
[Node.js] proxy 환경에서 node.js 설정
| 졸리운_곰 | 2017.08.16 | 485 |
| 2 |
[Node.js] Node.js, Express, MongoDB를 이용하여 REST API 만들기
| 졸리운_곰 | 2016.06.06 | 771 |
| 1 |
Create a Web App and RESTful API Server Using the MEAN Stack
| 졸리운_곰 | 2016.06.05 | 2119 |

