日期:2014-05-16  浏览次数:20382 次

为什么不响应onclick
<!DO
CTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<script>
  document.getElementById("ttt").onclick = y1; 
function y1()
{
  window.open("test.jpg","test","height=400,width=400,menubar=no,location=yes,Resizable=no");
  return false;
  }
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<a href="#" id="ttt">link1</a>
</body>
</html>

------解决方案--------------------
必须写在这些元素之后 
============
在这些元素加载之后执行