asp : DataList에 div가 있습니다. 여기에는 다른 div가 포함되어 있습니다. 나는 document.getElementByID("")
에 의해 div를 찾으려고 노력했다. 자바에서 데이터 목록의 Div 찾기
Unable to get property 'style' of undefined or null reference.
을 나는 .getElementById
이 그것을 찾을 수 있음을 이해 결과. 그럼 어떻게받을 수 있습니까? 나는 오래된 자료로 나의 데이터리스트를 찾으려고 노력했지만 그 중 아무 것도 내 문제와 일치하지 않는다.
참고 : 내 divs
은 드래그해야하지만,이 문제로 인해 위치 값을 얻을 수 없습니다.
코드 : 함수가 온로드라고
function FullDragging() {
// some code
var dd = document.getElementById("DesigningDiv"); // frame
var logoObject = document.getElementById("logoObject"); // draggable element
var nameObject = document.getElementById("nameObject"); // draggable element
function getDesigningDivSize() {
var dd = document.getElementById("DesigningDiv");
var aspDesigningDivHF = document.getElementById('<%=aspDesigningDivHF.ClientID %>'); // hidden-field which sends the changes in client-side to the server.
aspDesigningDivHF.value = parseInt(dd.style.width) + "," + parseInt(dd.style.height);
}
}
window.onload = FullDragging;
때문에 에러가 온로드 나타납니다.
HTML : 아이디는 HTML 문서에 한 번 나타나야로
<asp:DataList ID="DataList1" runat="server" DataKeyField="ProductID" Height="400px" Width="1400px" OnEditCommand="DataList1_EditCommand" OnItemCommand="DataList1_ItemCommand" CellPadding="40" RepeatColumns="2" RepeatDirection="Horizontal" OnCancelCommand="DataList1_CancelCommand" OnItemDataBound="DataList1_ItemDataBound" OnUpdateCommand="DataList1_UpdateCommand">
<ItemTemplate> ... </ItemTemplate>
<EditItemTemplate>
<div id="DesigningDiv" style="height: 150px; width: 262.5px; border-style: groove; border-color: inherit; border-width: 1px; position: relative; height: 158px; width: 270px; background-color: #FFFFFF; visibility: hidden">
<div id="logoObject" style="width: 51px; top: 31px; position: absolute; height: 34px; font-family: 'times New Roman', Times, serif; font-size: xx-large; font-weight: bold; color: #333333; cursor: move; left: 187px;"> logo </div>
<div id="nameObject" style="width: 61px; top: 31px; position: absolute; height: 22px; font-family: 'times New Roman', Times, serif; color: #666666; font-size: large; cursor: move; font-weight: bold; left: 29px; bottom: 105px;"> full name </div>
</EditItemTemplate>
</asp:DataList>
오류를 나타내는 코드를 추가하십시오. – jgillich
관련 HTML은 무엇입니까? 그리고 자바 스크립트? 우리가 당신의 문제를 볼 수 있다면 우리가 도울 수 있습니다. –
editted .. 나는 그것이 충분히 분명하기를 바란다. 그렇지 않다면, 무엇을 말하면 깊이 설명하기 위해 최선을 다할 것입니다. – Quaion