<html>
<head>
<style type="text/css">
div { position:absolute; width:100px; height:100px; }
#s1 {
background:pink; left:50px; top:50px;
visibility:hidden;
}
#s2 { background:skyblue; left:250px; top:250px; }
</style>
<script>
window.onload=function(){
function aa(){
b1.onclick=function(){
s1.style.visibility="visible";
//s2.style.visibility="visible";
}
b2.onclick=function(){
s1.style.visibility="hidden";
//s2.style.visibility="hidden";
}
}
document.onmousedown=aa;
}
</script>
</head>
<body>
<input type="button" value="보이기" id="b1">
<input type="button" value="숨기기" id="b2">
<div id="s1"></div>
<div id="s2"></div>
</body>
</html>
<head>
<style type="text/css">
div { position:absolute; width:100px; height:100px; }
#s1 {
background:pink; left:50px; top:50px;
visibility:hidden;
}
#s2 { background:skyblue; left:250px; top:250px; }
</style>
<script>
window.onload=function(){
function aa(){
b1.onclick=function(){
s1.style.visibility="visible";
//s2.style.visibility="visible";
}
b2.onclick=function(){
s1.style.visibility="hidden";
//s2.style.visibility="hidden";
}
}
document.onmousedown=aa;
}
</script>
</head>
<body>
<input type="button" value="보이기" id="b1">
<input type="button" value="숨기기" id="b2">
<div id="s1"></div>
<div id="s2"></div>
</body>
</html>
'개발하자 > 자바스크립트' 카테고리의 다른 글
Math객체 (0) | 2015.02.24 |
---|---|
객체를 생성하는 방식 두가지 (0) | 2015.02.24 |
prototype 으로 메서드 생성해서 공용으로 사용하기 (0) | 2015.02.24 |
Car.prototype.getSpeed (0) | 2015.02.24 |
prototype (0) | 2015.02.24 |