61,111
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
</head>
<body>
<div id="d1">
<input type="button" value="button1" onclick="document.getElementById('d2').innerHTML=this.value.toUpperCase();"></button>
<input type="button" value="button2" onclick="document.getElementById('d2').innerHTML=this.value.toUpperCase();"></button>
</div>
<div id="d2">
</div>
</body>
</html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style>
div {
border:solid 1px red;
width:200px;
height:200px
}
</style>
<script>
$(function(){
$('#d2 button').hide();
$('#d1 button').each(function(index,obj){
$(this).click(function(){
$('#d2 button').eq(index).show().siblings().hide()
})
})
})
</script>
</head>
<body>
<div id="d1"><button>button1</button><button>button1</button></div>
<div id="d2"><button>BUTTON1</button><button>BUTTON2</button></div>
</body>
</html>