IE6 Link A's href to JavaScript protocol does not jump on the current page _javascript tips

Source: Internet
Author: User
There are several benefits to using link a instead of a button when cutting a page

Hand-like effect by default when mouse is placed (without adding cursor:pointer)
Can add pseudo classes supported by low version IE

If you click on the page to the overall refresh, that is, jump, then IE6 is not satisfactory, as follows
Copy Code code as follows:

<p><a href= "javascript:;" onclick= "Jumpsina ()" >Sina</a></p>
<p><a href= "Javascript:void 0;" onclick= "Jumpsohu ()" >Sohu</a></p>
<script>
function Jumpsina () {
Location.href = ' http://www.sina.com.cn '
}
function Jumpsohu () {
Location.href = ' http://www.sohu.com '
}
</script>

IE6 Click on the link can not jump, other browsers are OK. The solution is to change the anchor point,
Copy Code code as follows:

<p><a href= "###" onclick= "Jumpsina ()" >Sina</a></p>
<p><a href= "#none" onclick= "Jumpsohu ()" >Sohu</a></p>
<script>
function Jumpsina () {
Location.href = ' http://www.sina.com.cn '
}
function Jumpsohu () {
Location.href = ' http://www.sohu.com '
}
</script>

If you change the jump mode to window.open, then IE6 no problem, as follows
Copy Code code as follows:

<p><a href= "javascript:;" onclick= "Jumpsina ()" >Sina</a></p>
<script>
function Jumpsina () {
window.open (' http://www.sina.com.cn ')
}
</script>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.