- 전체
- 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)
JavaScript 좀 예전시절 접었다 폈다 하는 javascript 소스
2019.01.28 19:25
좀 예전시절 접었다 폈다 하는 javascript 소스
* 첫번째 방법
<a class="more" onclick="this.innerHTML=(this.nextSibling.style.display=='none')?'[닫기]':'[열기]';this.nextSibling.style.display=(this.nextSibling.style.display=='none')?'block':'none';" href="javascript:void(0);" onfocus='blur()'>제목</a><div style="DISPLAY: none">내용</div>
<a onclick="this.nextSibling.style.display=(this.nextSibling.style.display=='none')?'block':'none';"href="javascript:void(0)">펼치기</a>
<div style="DISPLAY: none">내용
<a onclick="this.parentNode.style.display='none';" href="javascript:void(0)">접기</a>
</div>
* 두번째 방법
<div id="clasp_1" class="clasp"><a href="javascript:lunchboxOpen('1');">Open Lunchbox 1...</a></div>
<div id="lunch_1" class="lunchbox">This is lunchbox 1<br />Peanut Butter & Jelly<br />Potato Chips<br />Apple</div>
<div id="clasp_2" class="clasp"><a href="javascript:lunchboxOpen('2');">Open Lunchbox 2...</a></div>
<div id="lunch_2" class="lunchbox">This is lunchbox 2<br />Liverwurst (bleh!)<br />Twinkies<br />Fig Newtons</div>
//css//
..clasp {
text-align:center;
}
.lunchbox {
display:none;
}
//스크립트//
<script type="text/javascript">
function lunchboxOpen(lunchID) {
document.getElementById('lunch_' + lunchID).style.display = "block";
document.getElementById('clasp_' + lunchID).innerHTML="<a href=\"javascript:lunchboxClose('" + lunchID + "');\">Close Lunchbox " + lunchID + "...</a>";
}
function lunchboxClose(lunchID) {
document.getElementById('lunch_' + lunchID).style.display = "none";
document.getElementById('clasp_' + lunchID).innerHTML="<a href=\"javascript:lunchboxOpen('" + lunchID + "');\">Open Lunchbox " + lunchID + "...</a>";
}
</script>
참고: http://www.brenz.net/snippets/open_close_div.asp
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 1 |
[MSA] 마이크로서비스 디자인 패턴
| 졸리운_곰 | 2021.02.21 | 457 |

