0
出於某種原因,我的photo.onerror圖像沒有加載,因爲我通過圖像選項卡並遇到一個沒有設置,onerror圖像仍然不會加載,請參閱這有什麼不對?如何用新圖像替換onerror src圖像
if (document.getElementById("draft_player_photo")) {
var photo = document.getElementById("draft_player_photo");
photo.src = "http://www.myfantasyleague.com/player_photos_2013/" + pid + "_thumb.jpg";
photo.alt = playerDatabase['pid_' + pid].name;
photo.title = playerDatabase['pid_' + pid].name;
photo.onerror = "this.onerror=null;this.src='http://www.myfantasyleague.com/player_photos_2010/no_photo_available.jpg';";
}
這不是jQuery的旁路。 – Turnip
難道你不能只遍歷所有具有該ID的圖像,並將每個的src設置爲你想要的那個? –
你在嘗試這樣的事情嗎? http://jsfiddle.net/kn816rr1/ – Sushil