JS under IE6 window.location.href jump to Absolute path __js

Source: Internet
Author: User

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<title id= "Title1" runat= "Server". </title>

<script type= "Text/javascript" >

function Clickt () {

window.location.href= ' pages/client/addclient.jsp ';

}

</script>

<body>

<input value= "click" type= "button" onclick= "Clickt ();"/>

</body>

When I click on the button, I get this result:

The page cannot be displayed

The page you are are looking for is currently unavailable. The Web site might is experiencing technical difficulties, or you'll need to adjust your settings.

Debugging for a long time, do not know what the reason, and then consider the IE6 will be all the labels automatically fill the full address, so write the full path

Put

function Clickt () {

window.location.href= ' www.g.cn ';

}

Amended to

function Clickt () {

My project name: CRM11, in this can not add http://, absolute path: As long as the project name/jump page

window.location.href= '/crm11/pages/client/addclient.jsp ';

}

The problem is resolved, and the final code is as follows:


Code

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<title id= "Title1" runat= "Server". </title>

<script type= "Text/javascript" >

function Clickt () {

window.location.href= '/crm11/pages/client/addclient.jsp ';

}

</script>

<body>

<input value= "click" type= "button" onclick= "Clickt ();"/>

</body>

Summary: IE6 under the Window.location.href value must be written on the full address, cannot use relative address.

Add a question:

IE6 the solution with a label button:


1. The event must return False

<a href= "javascript:void (0);" onclick= "event (); return false;" ></a>

2, the href attribute of a label is set to an anchor point.


<a href= "#" onclick= "event ();" ></a>



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.