---
title: "IE6/7/8/Opera不支持script元素的onerror事件"
author: "zhouyrt"
date: "2011-08-09T14:16:33Z"
tags: []
categories: ["Web前端"]
slug: "ie6-7-8-opera-script-onerror"
draft: false
lastmod: "2011-08-09T14:16:33Z"
id: 1143446
url: "https://snandy.iteye.com/blog/1143446"
---

如下

```
<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<title>IE6/7/8/Opera不支持script元素的onerror事件</title>
		<script src="jquery-1.5.23.js" onerror="alert(3)"></script>
	</head>
	<body>
	</body>
</html>
```

 

script元素所引用的js文件不存在。结果如下：

IE9/Firefox/Safari/Chrome : 弹出了3

IE6/7/8/Opera : 没有弹出

Opera还比较特殊，虽然它不支持onreadystatechange事件，但它具有readyState属性。