我需要在返回多值的函數中使用if語句。我試過這個,但它不起作用。如果返回語句中的條件
a(this).attr('src', function(i, current){
if (i == 'http://www.old.com'){
return current.replace('http://www.old.com','http://www.new.com');
}
else if (i == 'http://www.older.com'){
return current.replace('http://www.older.com','http://www.new.com');
}
else();
});
爲什麼你有一個空封鎖其他? – jbabey
「不工作」是什麼意思? – j08691
不應該是'else {}'?或者更好的是,完全放棄它? –