图片加载错误显示默认图片

时间:2022-11-07 17:26:38
    <script language="javascript">
        (function() {
            var ImgNode = document.getElementsByTagName("img");
            for (var i = 0; i < ImgNode.length; i++) {
                ImgNode[i].onerror = function() { this.src = "/noimg.jpg"; }
            }
        })();
    </script>