在链接中如果加了链接后还加了事件window.location.href 后将两将触法此事件
2010-05-26 12:49
295 查看
害了花了好长的时候来发现这个问题
代码:
<script type="text/javascript">
function Confir(url, mess) {
if (confirm(mess)) {
window.location.href = url;
return true;
}
else {
return false;
}
}
</script>
<td align="center" style=" padding:6px; width:100px; text-align:center;"><a target="_parent" title="开始考试" onclick="return Confir('/BeginTest.aspx?PID=<%#Eval("PaperID")%>&R=<%=Rand() %>','您只有一次考试机会,你确定开考吗?','<%#Eval("PaperID")%>');"><img src="http://images.cnblogs.com/t.jpg" title="" alt="考试中途不能退出" style="border:0px; cursor:pointer" /></a></td>
在这上面如果在加链接:将会触发两次被链接文件
代码:
<script type="text/javascript">
function Confir(url, mess) {
if (confirm(mess)) {
window.location.href = url;
return true;
}
else {
return false;
}
}
</script>
<td align="center" style=" padding:6px; width:100px; text-align:center;"><a target="_parent" title="开始考试" onclick="return Confir('/BeginTest.aspx?PID=<%#Eval("PaperID")%>&R=<%=Rand() %>','您只有一次考试机会,你确定开考吗?','<%#Eval("PaperID")%>');"><img src="http://images.cnblogs.com/t.jpg" title="" alt="考试中途不能退出" style="border:0px; cursor:pointer" /></a></td>
在这上面如果在加链接:将会触发两次被链接文件
相关文章推荐
- window.location.href不转跳的解决方法 与a标签空链接有关
- window.location.href="某个链接";无效的原因
- window.location.href = window.location.href 跳转无反应 a超链接onclick事件写法
- window.location.href = window.location.href 跳转无反应 a超链接onclick事件写法
- window.location.href = window.location.href 跳转无反应 a超链接onclick事件写法
- window.location.href顶部链接乱码
- 解决JS在alert之后window.location.href跳转无法正常执行
- window.location.href=*.html访问没反应问题
- JS 中document.URL 和 window.location.href 的区别
- javascript中window.open()与window.location.href的区别
- window.location.href的用法
- ie下对于window.location.href的跳转时获取不到referer的,php中的路径包含有未定式的
- 关于火狐的中 javascript 的 window.parent.closeBox();window.parent.location.href='../User.aspx'; 出现 对话框的解决方法
- ie6使用window.location.href问题
- top.location.href = window.location.href;
- location.href、parent.location.href、top.location.href、 window.open实现页面跳转
- window.location.href和window.open的几种用法和区别
- IE6 中 window.location.href 不能跳转
- js获取当前页的URL与window.location.href简单方法
- 捕获浏览器的前进、后退事件 window.onhashchange 并区别于点击链接