Heim  >  Artikel  >  Web-Frontend  >  img标签中onerror用法_javascript技巧

img标签中onerror用法_javascript技巧

WBOY
WBOYOriginal
2016-05-16 18:48:161380Durchsuche

今日见一TX在HTML中写了以下代码img标签中onerror用法_javascript技巧
哎! 在FF上面还可以 但是在IE上面就不的,因为B/S结构有很多因素引发onerror,此处在发生onerror的时候给当前图片重新制定个地址
可是这会引起再因网络原因或其他原因使图片不能正常加载的话 这样就是再次调用onerror,基于微软的一套核心的浏览器就会认为这是死循环
然后就会报 stack overflow 的错误。
解决方案:
使用两个img标签中onerror用法_javascript技巧

复制代码 代码如下:


img标签中onerror用法_javascript技巧

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn