出于某种原因,当我点击图书清单元素时,它会显示两种形式(书籍和类),而不仅仅是书本形式,好像没有中断语句,我真的很困惑为什么要这样做?
<html>
<head>
<script type="text/javascript">
$(document).ready( function(){
$('.hideshares').hide();
$('#shareupdate li').click(function(){
switch($(this).attr('id')){
case "book":
$('.hideshares').hide();
$('#bk').show();
break;
case "class":
$('.hideshares').hide();
$('#cs').show();
break;
}
});
});
</script>
</head>
<body>
<div>
<ul id="shareupdate" >
<li id="book" >Books</li>
<li id="class">classes</li>
</ul>
</div>
<div id="sharecontainer">
<form id="bk" class="hideshares">
<div id="bookneeds"><input type="radio" id="ndbook" value="needbk" name="books" />Need book
<input type="radio" id="pstbook" value="postbk" name="books" />Post book
</div>
</form>
<form id="cs" class="hideshares">
<div><label>class:</label> <input type="text" id="cls" size="10"/></div>
<div> <input type="radio" id="dntknw" name="dontknw"/>I don't know yet </div>
</form>
</div>
</body>
</html>
答案 0 :(得分:0)
在外观和功能方面做了一些改变,但你的帖子对我很有用,没有太多问题;看看我的小提琴: