在下面的代碼中,我得到了一個錯誤:Internet Explorer 9中無法獲取屬性錯誤的值
Unable to get value of the property 'deal_score_round_img': object is null or undefined
調試器報告爲jdeals[i]['deal_score_round_img']
值:
"<img src=\"assets/deal_scores/80.gif\" width=\"40\" height=\"35\" />"
錯誤發生在第一行(typeof)。
if(typeof(jdeals[i]['deal_score_round_img'])!="undefined")
{
var nums = jdeals[i]['deal_score_round_img'].match(/([[0-9]+)/ig);
t.deal_score = nums[0];//80
}
該腳本的目的是從圖像字符串中提取「80」。
任何想法的人?
哇,這是我第一次見過的typeof沒有空間使用在它和它的操作數之間,我以爲你試圖在那裏調用一個特殊類型的函數! – TheZ
是的,人們說我應該多用空格! –
這看起來不像我的建議,看起來像GrailsGuy的解決方案,或者你可以自己添加一個答案:) – TheZ