When the href linked to A in IE6 is javascript, It is not displayed on the current page _ javascript tips

Source: Internet
Author: User
In IE6, when the href of link A is javascript, it cannot be redirected to the current page. This example provides an effective solution. You may wish to refer to the section when cutting down the page, sometimes using link A to replace the button, there are several advantages to doing so.

By default, the mouse has a hand effect (you do not need to add cursor: pointer)
You can add pseudo classes supported by earlier IE versions.

If you need to refresh the page as a whole, that is, jump, then IE6 is not satisfactory, as shown below:

The Code is as follows:


Sina


Sohu


Script
Function jumpSina (){
Location. href = 'HTTP: // www.sina.com.cn'
}
Function jumpSohu (){
Location. href = 'HTTP: // www.sohu.com'
}
Script


In IE6, clicking a link cannot jump, and other browsers can. The solution is to change it to an anchor,

The Code is as follows:


Sina


Sohu


Script
Function jumpSina (){
Location. href = 'HTTP: // www.sina.com.cn'
}
Function jumpSohu (){
Location. href = 'HTTP: // www.sohu.com'
}
Script


If you change the Redirect mode to window. open, there is no problem in IE6, as shown below:

The Code is as follows:


Sina


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.