課程
/前端開發
/JavaScript
/用JS實現購物車特效
為什么每操作刪除一行,控制臺提示getElementsByTayName of undifined代碼如下:
2016-11-10
源自:用JS實現購物車特效 2-13
正在回答
把for循環格式變一下就不報錯了
del.onclick=function(){ ? ? for(var i=0;i<tr.length;i++){ ? ? ? ? var inputs=tr[i].getElementsByTagName("input"); ? ? ? ? if(inputs[0].checked){ ? ? ? ? ? ? tr[i].parentNode.removeChild(tr[i]); ? ? ? ? ? ? i--; ? ? ? ? } ? ? } }
小章魚丸
舉報
通過JavaScript實現類似淘寶網絡購物車功能效果
1 回答為什么提示我window.onload is not a function
1 回答源代碼 怎么實現不了 增加刪除啊
2 回答為什么一直提醒我if (var j = 0, len = getgs.length; j < len ; j++) { 這一行老是意外的變量
1 回答為什么這段作數量增加的代碼運行無反應
2 回答老師用的什么開發平臺?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-09-17
getElementsByTayName改成
getElementsByTagName
2016-11-28
把for循環格式變一下就不報錯了
del.onclick=function(){
? ? for(var i=0;i<tr.length;i++){
? ? ? ? var inputs=tr[i].getElementsByTagName("input");
? ? ? ? if(inputs[0].checked){
? ? ? ? ? ? tr[i].parentNode.removeChild(tr[i]);
? ? ? ? ? ? i--;
? ? ? ? }
? ? }
}