日期:2014-05-17  浏览次数:20707 次

a标签中如果有onclick事件,从新标签页打开链接时当前页面无法正常显示
RT,有两个页面A.html和B.html,A中有个链接<a href="B.html" target="_blank" onclick="ABC()">aaa</a>,打开链接后B页面能够正常显示,但是A页面始终是空白页面,一直“正在获取数据”,如果没有onclick事件时A、B页面都能正常显示。请问这该怎么解决?

------解决方案--------------------
<!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>
<title></title>
<script type="text/javascript">
var id = 100
function hre(aid) {
script = document.createElement("script");
script.type = "text/javascript";
script.src = "B.aspx?aid=" + aid;
document.getElementsByTagName("head")[0].appendChild(script);
}
</script>
</head>
<body>
<a id="a1" href="http://www.baidu.com" onclick="hre(id);return false;" target="_blank">aaa</a>
</body>
</html