<img src="http://www.power-depot.com/images/battery_pse/mid/ABC.jpg" onerror="!this.e?(this.e=1,src='1.gif'):this.e==1?(this.e=2,src='2.gif'):src='default.gif'"> !this.e?是判断什么?
this.e==1?又是代表什么?
高人请指教!最好可以都解释下
this.e==1?又是代表什么?
高人请指教!最好可以都解释下
this.e==1?这又是在判断什么?
清高人指点
!this.e?(this.e=1,src='1.gif'):this.e==1?(this.e=2,src='2.gif'):src='default.gif'为多目运算等价于下面语句if(!this.e){
this.e=1;
src='1.gif';
}else(
if(this.e == 1){
this.e = 2;
src = '2.gif';
}else{
src = 'default.gif';
}
)
!this.e?(this.e=1,src='1.gif'):this.e==1?(this.e=2,src='2.gif'):src='default.gif'为多目运算等价于下面语句if(!this.e){
this.e=1;
src='1.gif';
}else(
if(this.e == 1){
this.e = 2;
src = '2.gif';
}else{
src = 'default.gif';
}
)
!this.e?(this.e=1,src='1.gif'):this.e==1?(this.e=2,src='2.gif'):src='default.gif'为多目运算等价于下面语句if(!this.e){
this.e=1;
src='1.gif';
}else(
if(this.e == 1){
this.e = 2;
src = '2.gif';
}else{
src = 'default.gif';
}
)
!this.e?(this.e=1,src='1.gif'):this.e==1?(this.e=2,src='2.gif'):src='default.gif'为多目运算等价于下面语句if(!this.e){
this.e=1;
src='1.gif';
}else(
if(this.e == 1){
this.e = 2;
src = '2.gif';
}else{
src = 'default.gif';
}
)
!this.e?(this.e=1,src='1.gif'):this.e==1?(this.e=2,src='2.gif'):src='default.gif'为多目运算等价于下面语句if(!this.e){
this.e=1;
src='1.gif';
}else(
if(this.e == 1){
this.e = 2;
src = '2.gif';
}else{
src = 'default.gif';
}
)
!this.e?(this.e=1,src='1.gif'):this.e==1?(this.e=2,src='2.gif'):src='default.gif'为多目运算等价于下面语句if(!this.e){
this.e=1;
src='1.gif';
}else(
if(this.e == 1){
this.e = 2;
src = '2.gif';
}else{
src = 'default.gif';
}
)
this.e=1;
src='1.gif';
}else(
if(this.e == 1){
this.e = 2;
src = '2.gif';
}else{
src = 'default.gif';
}
)解译为:当图片http://www.power-depot.com/images/battery_pse/mid/ABC.jpg不存在时用1.gif替换,前二者都不存在时用2.gif替换,前三者都不在时用default.gif替换
<img src="http://www.power-depot.com/images/battery_pse/mid/ABC.jpg"onerror="!this.e?(this.e=1,src='1.gif'):this.e==1?(this.e=2,src='2.gif'):src=''default.gif'" e='1' > e 表示img的一个自定义属性,把值设置不为空就会执行
this.e==1?(this.e=2,src='2.gif'):src=''default.gif'"
如果e的值等于1 则img的src为2.gif,否则为default.gif
我想请问,e是一个什么属性呢?是javascrip自身带的吗?是exit得简略吗?
是否是存在就true,不存在就false?
}catch(e){//这里都e跟this.e的e是一个意思,你可以看看try catch语句说明}