error

English [?er?(r)] US [??r?]

n. ??, ??, [??] ??, ?? ??

jquery ??() ??? ???

??: ??? ??(???? ???? ??)? ???? ?? ???? ?????. error() ???? ?? ???? ?????? ?? ???? ??? ? ??? ??? ?????. ? ???? ???('error', handler)? ?????.

?? ??? ?? ???: $(selector).error()

??? ?? ??? ??? ???: $(selector).error(function)

????:

??????
?? ????. ?? ???? ??? ? ??? ??? ?????.

jquery ??() ??? ?

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("img").error(function(){
    $("img").replaceWith("<p><b>圖片未加載!</b></p>");
  });
});
</script>
</head>
<body>
<img src="http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg" />
<p>如果上面的圖像沒有正確地加載,會被替換為一段 "圖片未加載" 的文本。</p>
</body>
</html>
???? ?? ?

??? ????? ??? "???? ??" ??? ?????