JS~对img标签进行优化,使用onerror进行默认图像显示
对于网站图像的不显示有很多原因,网络问题,文件本身问题,文件URL问题等,而当图像加载失败时会触发onerror这个事件,我们利用这点,可以有效的避免图像加载失败的尴尬!
JS代码
//图像加载出错时的处理
function errorImg(img) {
img.src = "http://static.xuexiba.com/uploadfile//UserInfo/Avatar/201403/1303992393385832875324.jpg";
img.onerror = null;
}
HTML代码
<img width="" height="" src="1.jpg" onerror="errorImg(this)" />
页面效果
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtIAAACKCAIAAAAISjpOAAAgAElEQVR4nO2cy4tkSfXHL73of2DA2vxQBEEKkcRKHS27VRSGWirSoM50MpDD4EYXMtQgKIMgs7guEly4bVRw6VgjJi50qIJezEZEulMld2ZXayVdPf2ie7ptqyp+i+iMPDceJx75uHFvfz+LIisz7olzz4nH90ZEZiEAAAAAANZCUbcDAAAAAHhegOwAAAAAwJoo9gEAAAAAFuPll18OlR0rVjYAAAAAaDmQHQAAAABYE9Gy42VQN83NBRWv6690bTVmCILgBSFqK9lmthbHaowGrTpadoRcAFZHc3OhyY41V9q4cC0RBMELQtRWss1sLY7VGA3IjgbT3FxAdtQFguAFIWor2WYWsoMHsiMj6spFURRFsdBXqQNlx4IVaZej6QoEIQCEqK1Ez3Yx488igxXjmDKr2Y+tzizvqrQIg7Hv9Q2yo8EskouEhmVenua2YGWHq/kybZ2yt7fn6qhougJBCAAhaivrkR2xY6nXMXNACxyfmcGQqbQoik6nE3KnjJP8vUN2NJjFZUfgv2JhmeLy3Op8VDdjCmtXoekKBCEAhKitpMmOkOHOHD/VzB0yNkY55h0MTWeo/vBW6nXeevvyEvoR4+dyZEen01F3u7e3F2JoRfR6vaIoer3e4qbKstTa2Wg0Srg2xBlXXbwP65cdgda8WGVHEYy1auaFVqmsUXXFoihonMPvIgqtutjLZcMuFu5fZpvRYms219FoZLY9hatxMh/xBmNRVfCPaOHkLDv48U01Y7OBmR/RQdva+K1zVaNZZHZnQmEdeRaXHWZ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OPvCCFxa9+8+D6358IId47+PBT3YkQ4u5bP1YXnt6/d+ubXz+6uJ1ctX4vMbKDHjPGT3csH5/smH93vyoX9J8vjFntoN+Jr8jKWZlxd74QQvM+7ma/yWLFKgK8ysD6foJSYYxHuaGwyo6+47zC84kRospzM/3VCtcXaIUQ1mm++sXXeTsflqW7zVu+geLyJ8oO4w+LXXYMy75VdphnMlz18v6E22H8Wb/sUJ2UGQd4x0RqT1+K7Lj9+mu3X3/tzu4b0y9fUOsZP//FPSHExZduCiHeO/hQLnjQ1Y6To/88Pth/fLB/9j/7N1yWIDvob9fQH10gv+WCo2orwZU88+v11RxRCTim30shjx3P/qWvRXVVQ1uQV7+6UZZ9VZ7U++x9OUxbZQf9jswqJr+Ec+xmh2fGkeSRSyvp9SHBDYU1CCryOP0tjBBVf8NK6z72nwujl9CQku5Q6YOuXzG32nH7E2fH7Y8Tlx0RIzuYehl/ouy4/Fmn7NC6bVF9qNCu4h1L6+le52M3WU4fPJAv3v7ZnXv3T6Xs+Mtfn0jZceeHbz452H9ysC+EOL175/jVy//+5CfE6Vla1Rr/Dxm3/8sNza6KAAAAAElFTkSuQmCC" alt="" />
JS~对img标签进行优化,使用onerror进行默认图像显示的更多相关文章
- JS使用onerror进行默认图像显示,可代替alt
JS代码 //图像加载出错时的处理 function errorImg(img) { img.src = "默认图片.jpg"; img.onerror = null; } HTM ...
- jQuery对标签select优化:实现模糊搜索查询功能
由于select标签中的option条数较多,翻页查询比较麻烦,需要对select标签进行优化,解决方法是通过增加模糊查询功能来提高用户体验感. 优化后的界面如下: 在实现这个优化的过程中,参考了两个 ...
- Asp.net 后台添加CSS、JS、Meta标签
Asp.net 后台添加CSS.JS.Meta标签的写法,我这里写成函数方便以后使用.如果函数放在页面类中, Page参数也可以不要. 首先导入命名空间 using System.Web.UI.Htm ...
- 通过js获得html标签的值
js获取html元素的值并赋值 1).input文本框 <input type="text" value="时间" placeholder="姓 ...
- 页面头部title、description、keywords标签的优化
页面头部优化<Head></Head>中间的区域中间的区域,我们称为网页的头部.在网页的头部中,通常存放一些介绍页面内容的信息,例如页面标题.描述及关键字等等.在头部优化中,除 ...
- 使用JS对HTML标签进行增删改查
以下为通过JS对li标签进行简单的增删改查: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" ...
- 转:浅谈关于b、h标签的优化技巧
<b>标签优化 <b>标签是一种加粗标记,作用就是加粗文章中的关键词,对于文章中重要的关键词加粗起到有利于用户阅读的作用.<b>标签的使用对于优化的作用是非常大的, ...
- js模拟form表单提交数据, js模拟a标签点击跳转,避开使用window.open引起来的浏览器阻止问题
js模拟form表单提交数据, js模拟a标签点击跳转,避开使用window.open引起来的浏览器阻止问题 js模拟form表单提交数据源码: /** * js模拟form表单提交 * @param ...
- 网站开发进阶(十八)js获取html标签中的值
js获取html标签中的值 项目开发过程中,由于需求所迫,需要获取html标签元素中的内容,下面做一简单总结.以下所讲的示例适用于其它标签元素. 主要包括2中方法获取元素内容: 方法一:.innerT ...
随机推荐
- 实现Android 动态载入APK(Fragment or Activity实现)
尊重原创:http://blog.csdn.net/yuanzeyao/article/details/38565345 近期由于项目太大了.导致编译通只是(Android对一个应用中的方法个数貌似有 ...
- 百度之星资格赛 hdu 4826 Labyrinth 动态规划
/********************* Problem Description 是一仅仅喜欢探险的熊.一次偶然落进了一个m*n矩阵的迷宫,该迷宫仅仅能从矩阵左上角第一个方格開始走,仅仅有走到右上 ...
- google login page
</pre><pre name="code" class="html"><div class="container&qu ...
- Android 基于Netty的消息推送方案之对象的传递(四)
在上一篇文章中<Android 基于Netty的消息推送方案之字符串的接收和发送(三)>我们介绍了Netty的字符串传递,我们知道了Netty的消息传递都是基于流,通过ChannelBuf ...
- 自定义控件 环形进度条 ProgressBar
使用 public class MainActivity extends Activity implements OnComompleteListener { private int num ...
- css3圈圈进度条
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...
- HTML 5 与HTML 4 的区别
(1)HTML 5 与HTML 4 的相比,语法的改变,以下四个方面: 字符编码改变举例: 省略标记值: (2)新增和废弃的元素 (3)新增html全局属性 (1)指定元素是否可编辑 (2)指定页面是 ...
- ruby.new
ruby.new 输出:print.puts.p 注释 #say hello =begin this is a long comment =end 变量 local: time or _time in ...
- 反射那些事儿——Java动态装载和反射技术
一直以来反射都是只闻其声,却无法将之使用,近日尽心下来学习下,发现了很多精妙之处. Java动态装载和反射技术 一.类的动态装载 1.Java代码编译和执行的整个过程包含了以下三个重要的机制: ● J ...
- AngularJs练习Demo17 ngRoute
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...