<img src="image_not_found.jpg" onError="this.style.display = 'none';" alt="" />
上面的代码在 chrome 中不起作用,删除后仍然显示找不到图像。但它适用于 firefox,我还应该添加什么才能使其适用于 chrome。我的是一个php网站
最佳答案
试试小写字母:
onerror="this.style.display = 'none'"
关于javascript - <img src ="image_not_found.jpg"onError ="this.style.display = ' none' ;"alt=""/> - 在 chrome 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19762508/