Cannot read property ‘getAttribute‘ of null
程序员文章站
2022-06-07 13:18:28
...
function popUp(winURL){
window.open(winURL,"popup","width=320,height=480");
}
window.onload = prepareLinks;
function prepareLinks(){
var a = document.getElementById("a");
if(a.getAttribute("class") == "popup"){
a.onclick = function(){
popUp(this.getAttribute("href"));
return false;
}
}
}
<a href="https://cn.bing.com/" class="popup" >Example</a>
下一篇: MySQL时间范围排序
推荐阅读
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object
-
npm ERR! Cannot read property 'path' of null
-
js报错 Cannot read property 'getAttribute' of null
-
微信小程序报Cannot read property 'setData' of undefined的错误
-
webpack报错Cannot read property 'presetToOptions' of undefined
-
Extjs4---Uncaught TypeError: Cannot read property ‘items’ of undefined
-
JavaScript Uncaught TypeError: Cannot read property 'value' of null
-
Cannot read property 'tap' of undefined
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#
-
Property or field ‘XXX‘ cannot be found on null