经常有如下JS跳转写法:
<a href="javascript:void(0);" onclick="javascript:location.replace ('http://www.baidu.com/');">test js location.replace()</a>
<a href="javascript:void(0);" onclick="javascript:location.href ='http://www.baidu.com/';">test js location.replace()</a>
经测试,在IE6下上述两种JS跳转履行无响应,其它浏览器下均正常。
细心解析,猜测IE6下a链接的跳转会收到href属性中代码的影响,上述代码的履行过程,貌似是先履行 onclick事务中的代码,并且是在onclick事务的回调函数返回true 的景象下,再履行href属性中的代码,然后才作出跳迁移转变作。而恰是void(0);代码阻拦了浏览器跳转,所以在onclick的代码最后,加上return false; 让onclick回调函数返回false值,以阻拦履行 href属性中的代码,如许就可以让浏览器顺利跳转。
<a href="javascript:void(0);" onclick="javascript:location.replace ('http://www.baidu.com/'); return false;">test js location.replace()</a>
<a href="javascript:void(0);" onclick="javascript:location.href ='http://www.baidu.com/'; return false;">test js location.replace()</a>
分享到:
相关推荐
-- <a href=""></a> -->超链接标签(用于从一个页面链接到另一个页面) <br> 文本超链接 <br> <a href="https://www.baidu.com/">百度</a> <div> <!-- <a href=" 不写值 ">百度</a> -->空链接 <br> <a href=""></...
如果使用a标签跳转到指定的div区域,则只需要把a标签的href属性设置为“#divId”就好了,比如: <a>跳转到div</a> <div di=dction_1> 这里是被跳转的区域 </div> 第二个,使用jquery添加或者移除class属性 也很...
<script type="text/javascript"> function gotoSelectedPage() { var x = document.getElementById("navigatorForm"); //alert("Original action: " + x.action) x.submit(); } </script> <form action=...
<p class="STYLE1"><a href="http://www.gy16.com"><a href="http://www.gy16.com/"><b><font color="#0000FF">电信主站</font></b></a><span class="STYLE2">:http://www.gy16.com</span> <a href=...
page=<%= intPageCount %>">尾页</a><br> <% } %>跳转到<br> <select name="page" onChange="javascript:this.form.submit();"><br> <% for(i=1;i<=intPageCount;i++){%> <br> <option value="<%= i %>" <% if(int...
<script type="text/javascript" src="/soft08/js/queryStudent.js"></script> </head> <body> <h1> 学生信息查询 </h1> <form action="/soft08/StudentSer" method="post"> 学生姓名 <input ...
4、MyText:正常显示文本 如第{0}页 则显示为<li><a href='news.aspx?page=页码&type=1'>第{页码}页</a></li> 5、MyTextTop:第一页 如首页 则显示为 <li><a href='news.aspx?page=1&type=1'>首页</a></li> ...
<a id="dengl" href="javascript:;">登录</a> <!--登录--> <i>|</i> <a id="zc" href="javascript:;">注册</a> <!--注册--> </div> <div class="box-b-s"> <p id="shij"></p> <!--获取当前...
if (this.pageCount >= startPage + 10) strHtml += '<span title="Next 10 Pages"><a href="javascript:' + this.name + '.toPage(' + (startPage + 10) + ');">...</a></span>'; if (nextPage > this....
</font><a href="chknews.asp"><FONT COLOR=<%=bgclr4%>><% = strcat %></font></a></td></TR></table> <% Const MaxPerPage=20 dim totalPut dim CurrentPage dim TotalPages dim j ...
4、MyText:正常显示文本 如第{0}页 则显示为<li><a href='news.aspx?page=页码&type=1'>第{页码}页</a></li> 5、MyTextTop:第一页 如首页 则显示为 <li><a href='news.aspx?page=1&type=1'>首页</a></li> <li><a...
<p>> <span>ERROR </span>: "<i>服务器地址已改变</i>"</p><p>> <span>ERROR CODE</span>: "<i>HTTP 403 Forbidden</i>"</p> <p>> <span>ERROR DESCRIPTION</span>: "<i>您没有在此服务器上访问此页面的权限!</i>"...
<li><nuxt to={name:>HOME page</nuxt></li> <li><nuxt to={name:>NEWS page</nuxt></li> <li><nuxt to={name:>PLAY page</nuxt></li> </ul> 注意说明: to 前面有冒号“ : ” to 后面跟的是路径比如“/page/...
<tr> <td><div align="center">Email地址</div></td> <td><div align="left"> <%=email%><%=select%></div></td> </tr> <tr><td><div align="center">登录密码</div></td><td><div align="left"><%=pwd%></div></td>...
本文实例讲述了vue跳转方式(打开新页面)及传参操作... <span class=spanfour>link跳转</span> </router> // 添加参数 <router to={path:> </router> // 参数获取 id = this.$route.query.id // 新窗口打开 <router
好看、大方不错的跳转页面 <!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> ...
<p><strong><span id="span_text">系统会在<span id="span_timer">3</span>秒后,自动跳转到如下网址:</span></strong><br /> <a id="a_url" href="http://download.csdn.net/" class="font_red">...
href="servlet/ServletDemo1">条形统计图</a>;</li> <!--跳转到ServletDemo1生成条形统计图--> <li>可以选择统计图类型 <a href="chart1.html">三种类型</a> <!--链接到chart1.html--> </li> </ul> </BODY> </HTML>
按回车键时跳到下一个表单元素<br>JumpToNextElement() 用于按回车键时跳到下一个表单元素(统一处理按回车键的问题)<br>在页面调用:<br><script Language="Javascript"><br> document.onkeypress = ...
2.使用方式<a style="color: #e5e9ee" target="_blank" href="alert:http://127.0.0.1/test/login?use=123separatorUserID=ee" data-title="网吧系统"><span></span>网吧系统</a>' 此处有多个参数时要用separator隔...