jquery的toggle用法,单击li变化不同的li的风格
<script>
$(function () {
$('li').toggle(
function ()
{
$(this).css({"ist-style-type":"disc","color":"red"});
},
function ()
{
$(this).css({"ist-style-type":"square","color":"blue"});
},
function()
{
$(this).css({"ist-style-type":"none","color":""});
}
)
});
</script>
<body>
<div>
<ul>
<li style="cursor: pointer">click me</li>
</ul>
</div>
</body>
<script>
$(function () {
$('li').toggle(
function ()
{
$(this).css({"ist-style-type":"disc","color":"red"});
},
function ()
{
$(this).css({"ist-style-type":"square","color":"blue"});
},
function()
{
$(this).css({"ist-style-type":"none","color":""});
}
)
});
</script>
<body>
<div>
<ul>
<li style="cursor: pointer">click me</li>
</ul>
</div>
</body>