<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function A(){
alert("被点击了")
}
</script>
</head>
<body>
<a href="#" onclick=A()>Addfdsfd</a>
</body>
</html>
这样就可以了
把window.onload=function(){}去掉就有效果了