日期:2014-05-17 浏览次数:20947 次
function a(){
alert(1);
}
<a href="javascript:a()">ss</a> <a href="#" onclick="a()">ss</a>
------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript">
function a(){
alert(1);
}
</script>
<title>04.15</title>
</head>
<body>
<a href="##" onclick="a()">点我</a>
<a href="javascript:a()">点我</a>
</body>
</html>
------解决方案--------------------
function a(){
alert(1);
}
<a href="#" onclick="a()">a</a>其中"#"可以代表本页面其实点击后它还在本页面可是它已经触发了onclick事件。
------解决方案--------------------
<a onclick="a()",href="javascript:">
这个样子也可以