以下代码在 FireFox 23.0.1 和 Chrome 29 中有效,但在 IE 10 中无效。可能是什么问题?
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function loadFile1(){
alert("loading...");
}
</script>
</head>
<body>
<a href="file2.html" id="link1">file 1</a>
<h2>Hello</h2>
<script type="text/javascript">
var arr = document.links;
document.links['link1'].onclick = loadFile1;
</script>
</body>
</html>