Posted in Javascript onOctober 23, 2013
switch(tagName){ case "span": node = element.parent().parent(); element = element; break; case "td": node = element.parent(); element = element.find("span"); break; default: node = element; break; } 以上语句等同于 if(tagName == "span"){ node = element.parent().parent(); element = element; }else if(tagName == "td"){ node = element.parent(); element = element.find("span"); }else{ node = element; }
注意每个case后,一定要加:break;
default,就相当于else
js switch case default 的用法示例介绍
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@