-1

jquery show() 方法可以工作,但是 toogle() 不工作,为什么?

<!DOCTYPE html>
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
.past{height:100%}
.past ul{list-style:none;float:left}
.past li{float:left}
.past .he{display:block;background:#eee;padding:10px;color:#3d3d3d;text-decoration:none;
margin-left:5px;
}
.past .he:hover{background:#fff}
.past ul ul{float:none;margin:0;padding:0;position:absolute}
.past li li{float:none;margin:0;padding:0}
.past .sub{background:#EDEDED;padding:7px;color:#3d3d3d;text-decoration:none;display:block;
border-bottom:1px solid #ccc;
margin-left:5px;
}
.past .sub:hover{background:#F7F7F7}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>

<div class="past">
<h1 class="lcolh">Midterm Term Past Papers & MCQs</h1>
<ul><li><a href="javascript:;" id="41" class="he"> CS501 </a><script>
$( "#41" ).click(function() {
    $( "#41DIV" ).toogle();
});
</script><ul id="41DIV" style="display:none">       
        <li><a href="http://vubscs.com/thread-49.html" class="sub">CS501 Midterm Solved Subjective With References by Moaaz</a></li></ul></li><li><a href="javascript:;" id="37" class="he"> CS504 </a><script>
$( "#37" ).click(function() {
    $( "#37DIV" ).toogle();
});
</script><ul id="37DIV" style="display:none">       
        <li><a href="http://vubscs.com/thread-52.html" class="sub">CS504 Solved Midterm MCQs with Reference</a></li>        
        <li><a href="http://vubscs.com/thread-54.html" class="sub">CS504 Midterm Solved MCQs and Subjectives Mega file</a></li></ul></li>
</ul>
</div>

<br/>
<br/>
<br/>
<br/>
<br/>
</body></html>
4

1 回答 1

2

应该$("#your-id").toggle();不是.toogle();

于 2012-12-09T06:32:37.387 回答