能不能给个例子呢
追答function firstClick () {
// body...
}
function secClick () {
// body...
}
$("#ele").className = "first"
$("#ele").onclick=function () {
if (this.className === "first") {
this.className = "sec"
firstClick()
} else{
this.className = "first"
secClick ()
};
}