我已经编写了一个实现 jQuery 手风琴的代码。它在普通网络中工作正常,但在内容占位符 JavaScript (.js 文件)中没有触发 ul 标记的客户端 ID。请看下面的代码:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<style>
body, input {
font-family: Calibri, Arial;
}
#Accordion {
list-style: none;
padding: 0 0 0 0;
width: 250px;
}
#Accordion li {
display: block;
background-color: #323232;
font-weight: bold;
margin: 1px;
cursor: pointer;
padding: 5px 5px 5px 7px;
list-style: circle;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
color: white;
}
#Accordion ul {
list-style: none;
padding: 0 0 0 0;
display: none;
}
#Accordion ul li {
font-weight: normal;
cursor: auto;
color: #323232;
background-color: #fff;
padding: 0 0 0 7px;
}
#Accordion a {
text-decoration: none;
}
#Accordion a:hover {
text-decoration: underline;
}
</style>
<script>
$('#' + '<%= Accordion.ClientID %> > li').click(function () {
if (false == $(this).next().is(':visible')) {
$('#' + '<%= Accordion.ClientID %> > ul').slideUp(300);
}
$(this).next().slideToggle(300);
});
$('#' + '<%= Accordion.ClientID %> > ul:eq(0)').show();
</script>
<div style="float: left; padding: 0px 0px 10px 10px;">
<ul id="Accordion" class="accordion" runat="server">
<li>Sports</li>
<ul>
<li>Golf</li>
<li><a href="#">Cricket</a></li>
<li><a href="#">Football</a></li>
</ul>
<li>Technology</li>
<ul>
<li><a href="#">iPhone</a></li>
<li><a href="#">Facebook</a></li>
<li><a href="#">Twitter</a></li>
</ul>
<li>Latest</li>
<ul>
<li><a href="#">Obama</a></li>
<li><a href="#">Iran Election</a></li>
<li><a href="#">Health Care</a></li>
</ul>
</ul>
</div>
</asp:Content>
谁能帮我解决这个问题?谢谢!