0
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("input").click(
function(){
alert(this.id);
$('#comments'+this.id).show();
}
);
});
</script>
<style type="text/css">
.comments{
width:500px;
height:350px;
background:#06F;
display:none;
}
</style>
</head>
<body>
<input type="text" id="1"></input>
<input type="text" class="title" id="2"></input>
<input type="text" class="title" id="1"></input>
<div id="comments1" class="comments">box 1</div>
<div id="comments2" class="comments">box 2</div>
<div id="comments1" class="comments">box 3</div>
</body>
你不應該有多個ids ... – Paddy 2010-08-09 13:26:42
http://www.w3schools。 com/tags/att_standard_id.asp這裏給出瞭如何使用和id的規則。 – qw3n 2010-08-09 13:32:14