onerror event using background: url()

前端 未结 3 753
自闭症患者
自闭症患者 2020-12-23 20:46

Is there a way to show alternate image if source image is not found? I know to accomplish this is by doing something like below:



        
3条回答
  •  暖寄归人
    2020-12-23 21:32

    You can also use a dummy-image and use the onerror event from there ...

            $imageFoo = '
            
    ';

提交回复
热议问题