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

    <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>

 

posted @ 2012-09-17 14:37  xyzhuzhou  阅读(183)  评论(0编辑  收藏  举报