티스토리 뷰

SMALL

* style="display:~~" 속성

- 웹페이지의 특정 부분을 보이게 하거나 숨기게 하는 속성 (문서의 레이아웃에 영향을 주지않고 숨겨짐)
- style = "display:none" > 웹페이지의 특정 요소을 숨김
- style = "display:block" > 웹페이지의 특정 요소을 보이게 함

e.g. 테이블을 모두 안보이게 설정한 후, 클릭된 버튼에 따라 javascript 상에서 특정 테이블만 보이도록 함

// HTML Code

<table id="table1" style="display:none;">

<tr>

        <td> 1 </td>

        <td> 2 </td>

        <td> 3 </td>  

</tr>

</table>

 

<table id="table2" style="display:none;">

<tr>

        <td> 4 </td>

        <td> 5 </td>

        <td> 6 </td>  

</tr>

</table>

 

<input type="button" value=" table1 Click " onclick="javascript:SubmitValue('rTable1');">

<input type="button" value=" table2 Click " onclick="javascript:SubmitValue('sTable2');">


// Javascript Code

function SubmitValue(isResult)

{

     if(isResult == "rTable1"){

      document.getElementById("table1").style.display = "block";

     } else{

      document.getElementById("table2").style.display = "block";

     }

}


~~ (-_-) /
LIST
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함