[求助]求高手指點下面的代碼問題出在哪里_html/css_WEB-ITnose
來源:懂視網
責編:小采
時間:2020-11-27 15:47:40
[求助]求高手指點下面的代碼問題出在哪里_html/css_WEB-ITnose
[求助]求高手指點下面的代碼問題出在哪里_html/css_WEB-ITnose:myMap.prototype.isCollide=function(shape_data){ for(var i=0;i var row=shape_data[i].row; var col=shape_data[i].col; if(col if(row==this.height) return true; if(row else if(this.myLines[row][col]!=NoShape) return true; } return false
導讀[求助]求高手指點下面的代碼問題出在哪里_html/css_WEB-ITnose:myMap.prototype.isCollide=function(shape_data){ for(var i=0;i var row=shape_data[i].row; var col=shape_data[i].col; if(col if(row==this.height) return true; if(row else if(this.myLines[row][col]!=NoShape) return true; } return false

myMap.prototype.isCollide=function(shape_data){
for(var i=0;i<4;i++){
var row=shape_data[i].row;
var col=shape_data[i].col;
if(col<0 || col==this.width) return true;
if(row==this.height) return true;
if(row<0) continue;
else
if(this.myLines[row][col]!=NoShape)
return true;
}
return false;
}
運行的時候老是提示紅色那一行無法獲取屬性“undefined”的值,對象為NULL或未定義。
回復討論(解決方案)
發錯地方了
myLines row col
這三個變量有問題 檢查一下是否有定義,或者myLines[row][col]是否越界了
myLines是個什么東西?代碼貼全一點啊
而且,這個東西最好轉到js專區去。
myLines row col
這三個變量有問題 檢查一下是否有定義,或者myLines[row][col]是否越界了
就是越界了。。問題已經解決了,呵呵,多謝了。
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
[求助]求高手指點下面的代碼問題出在哪里_html/css_WEB-ITnose
[求助]求高手指點下面的代碼問題出在哪里_html/css_WEB-ITnose:myMap.prototype.isCollide=function(shape_data){ for(var i=0;i var row=shape_data[i].row; var col=shape_data[i].col; if(col if(row==this.height) return true; if(row else if(this.myLines[row][col]!=NoShape) return true; } return false