Daylogs/HTML
컨텐츠 열고 닫기 간단 구현
ohgyun
2008. 9. 3. 15:14
메일을 보내거나 할 때처럼 스크립트를 자유롭게 쓸 수 없을 때~
DOM 객체를 이용하도록 해본 것
! <input> 태그 사이의 공간이 있어선 안된다~
DOM 객체를 이용하도록 해본 것
! <input> 태그 사이의 공간이 있어선 안된다~
<div>
<span>제목</span>
<input type="button" value="show"
onclick="this.style.display = 'none';
this.parentNode.lastChild.style.display = '';
this.nextSibling.style.display = '';"
><input type="button" value="hide" style="display: none;"
onclick="this.style.display = 'none';
this.parentNode.lastChild.style.display = 'none';
this.previousSibling.style.display = '';"
>
<div style="display: none;">
이게 컨텐츠<br>
컨텐츠<br>
컨텐츠
</div>
</div>
<span>제목</span>
<input type="button" value="show"
onclick="this.style.display = 'none';
this.parentNode.lastChild.style.display = '';
this.nextSibling.style.display = '';"
><input type="button" value="hide" style="display: none;"
onclick="this.style.display = 'none';
this.parentNode.lastChild.style.display = 'none';
this.previousSibling.style.display = '';"
>
<div style="display: none;">
이게 컨텐츠<br>
컨텐츠<br>
컨텐츠
</div>
</div>
반응형