개발 Q&A

제목 div를 감추고 싶은데요~
글쓴이 수야디벨 작성시각 2012/11/27 12:14:48
댓글 : 5 추천 : 0 스크랩 : 0 조회수 : 15448   RSS


div를 감추고 싶은데요~

<div class="mw_popup open"><!-- mw_popup --> <!-- class="mw_popup open" 이카면 자동으로 열림 -->
                <div class="bg"></div>
                <div id="popup" style="width:870px; margin:-330px 0 0 -445px;"><!-- 레이어 가로 크기에따라 수동 조절 -->
                    <div class="pop_content">
                        <div class="popup_tit">
                        <h2>게시판 글쓰기</h2>
                        <a class="close" title="창닫기" href="#popup_anchor"></a>
                        </div>
           
                        <div class="write_item">
                        <p>
                            <label for="여기아이디">카테고리</label>
                            <span>
                            <select class="type_01">
                            <option>--</option>
                            </select>
                            </span>
                        </p>
           
                        <p>
                            <label for="여기아이디">제목</label>
                            <span>
                            <input type="text" />
                            </span>
                        </p>
           
                        <p>
                            <label for="여기아이디">장소</label>
                            <span>
                            <input type="text" />
                            </span>
                        </p>
                        </div>
           
                        <div class="write_edge">
                        여기 글쓰기 컴포넌트 / 높이: 560px<br />
                        여기 글쓰기 컴포넌트 / 높이: 560px<br />
                        여기 글쓰기 컴포넌트 / 높이: 560px<br />
                        여기 글쓰기 컴포넌트 / 높이: 560px<br />
                        여기 글쓰기 컴포넌트 / 높이: 560px<br />
                        여기 글쓰기 컴포넌트 / 높이: 560px
                        </div>
                        <div class="write_info">
                        <span class="file_tit">첨부파일</span>
                        <span class="file_info">이미지 <strong>0.2MB</strong></span>
                        </div>
           
           
                        <div class="write_btn">
                        <a href="#"><img src="../html/images/main/bbs_btn_01.gif" alt="미리보기" /></a>
                        <a href="#"><img src="../html/images/main/bbs_btn_02.gif" alt="올리기" /></a>
                        </div>
           
                    </div>
                </div>
            </div><!-- // mw_popup --> 
<!-- 로그인한 세션 정보를 받아온다 -->

예를 들어서 컨트롤러에서 위와같은 view를 호출한다고하면,

무조건 저 div코드로 짜진 화면이 보여지겠지요~?

(물론, 소스에 저 div만 있는건 아닙니다^^)


그런데 뷰를 처음 호출할때, 저 div를 화면에 보여주고 싶지 않은데 가능할까요?

* 제가 시도해본 방법

여러 검색을 통해서 div에 visibility 속성이 있다고 들었습니다.

<body onload=> 를 이용하면, view가 불러지자마자 호출을 하는거잖아요?


그래서 body onLoad를 통해서 바로 scirpt를 호출하고,
scirpt에서
function modal(){
  var layout = document.getElementsByClassName("mw_popup");
  layout.style.visibility = "hidden";
 }

클래스 이름으로 객체를 가져오고, 그거에 대한 스타일(visibility를) hidden으로 하면
안보여주지 않을까~ 했는데 안되네요 ㅠ

 다음글 ajax내부문서에서 jquery사용질문 (6)
 이전글 <a href="#아이디">... (4)

댓글

milosz / 2012/11/27 12:24:44 / 추천 0
 layout[0].style.visibility = "hidden";
한대승(불의회상) / 2012/11/27 12:26:00 / 추천 0
jquery 쓰신다면..

$('div.mw_popup').hide();
수야디벨 / 2012/11/27 13:18:09 / 추천 0
milosz//
오~ 감사합니다. 되네요 ㅎ

그런데 왜 laout[0] 이여야 하는걸까요???
수야디벨 / 2012/11/27 13:18:28 / 추천 0
불의회상//

도움 주셔서 감사합니다 .ㅎ
milosz / 2012/11/27 13:31:46 / 추천 0
 getElementsByClassName()은 해당 클래스명을 가진 DOM elements를 배열로 리턴합니다.