不传递函数就会直接切换此对象的显示隐藏状态如果传递多个函数就会依次循环执行传递的函数代码,而不是对选中的对象执行状态显示切换<div class="head">head</div><div>123</div><script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$('.head').toggle(function () {
alert(1)
$(this).next().toggle();
}, function () {
alert(2)
$(this).next().toggle();
}, function () {
alert(3)
$(this).next().toggle();
}, function () {
alert(4)
$(this).next().toggle();
});
</script>
<script type="text/javascript">
$('.head').toggle(function () {
alert(1)
$(this).next().toggle();
}, function () {
alert(2)
$(this).next().toggle();
}, function () {
alert(3)
$(this).next().toggle();
}, function () {
alert(4)
$(this).next().toggle();
});
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货