JavaScript IE问题

JavaScript IE问题,javascript,jquery,Javascript,Jquery,我有以下网站: 它存在一些java脚本(jquery 172)问题: 在IE9中加载时,它将转到服务器文件夹,而不是加载索引页。 在ie7+中,当单击“服务”选项卡,然后再次单击“概述”选项卡时,它将执行相同的操作。 它似乎还时不时地抛出随机错误。 jquery和IE7,8,9之间是否存在任何不兼容? 守则: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml

我有以下网站:

它存在一些java脚本(jquery 172)问题: 在IE9中加载时,它将转到服务器文件夹,而不是加载索引页。 在ie7+中,当单击“服务”选项卡,然后再次单击“概述”选项卡时,它将执行相同的操作。 它似乎还时不时地抛出随机错误。 jquery和IE7,8,9之间是否存在任何不兼容? 守则:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
    <script type="text/javascript" src="js2/jquery-1.7.2.min.js"></script>    
    <script type="text/javascript" src="js2/custom3.js"></script>
</head>
       <div class="main">
            <div class="contentNav clearfix">
                <ul class="secondaryNav">
                    <li><a id="activeLink" class="show1 navButton left" href="">Overview</a></li>
                    <li><a class="show2 navButton">Services</a></li>
                   </ul>
            </div>
            <div class="primaryContent clearfix">                   
                <div class="container clearfix">
                    <div  class="container1"> 
                        <h1>      
                            Fine Maid<br />                    
                             Bay C1 - 3911 Brandon St. S.E.<br />
                            Calgary, AB., T2G 4A7<br />                                                
                            (403) 454-5526<br />
                            For more information visit us at <a href=" http://www.finemaid.com/contact.php" title="Finemaid homepage" class="mainLink">www.finemaid.com</a>           
                        </h1>                    
                        <p class="clearfix">Fine Maid offers a fresh approach to the concept of Residential and Office Cleaning. Very openly, the company offers a variety of cleaning packages with fixed prices (which is something that many other major companies shy away from advertising on their websites). For custom cleaning projects or long-term janitorial cleaning contracts, Fine Maid will provide custom quotes upon consolations with prospective clients and visits to sites.</p>
                        <p>Many household are paying increased attention these days to their cleaning products used. Fine Maid offers residential cleaning services using – at customer's discretion – their eco friendly, scent-free, hypo-allergenic, and environmentally responsible cleaning products.
Fine Maid website provides a wealth of information regarding Government issued recall alerts, other advisory and useful content. For more information<a href="http://www.finemaid.com/useful_resources.php" target="_blank" title="More Info" class="mainLink"> visit here.</a></p>
                        <p>Booking your next cleaning appointment with Fine Maid can not be easier: for any of the fixed-priced residential / office cleaning packages, the website provides a step-by-step booking process (similar to an airline travel booking), allowing customers to book their preferred date and time for when the cleaning person or crew should arrive to their address to perform the cleaning tasks clearly stated in each package's description (which we recommend customers to read, for better understanding of what's included in a package and what not).</p>
                        <p>Fine Maid has clear-stated policies, and the "what happens if" is explained in great detail, giving customers peace of mind. You can book your next cleaning appointment in confidence with Fine Maid in Calgary and area!</p>         
                    </div>
                    <div class="container2">
                        <ul class="services">
                            <li>cleaning services Calgary </li>
                            <li>residential cleaning Calgary </li>
                            <li>office cleaning Calgary  </li>
                            <li>Calgary cleaning companies </li>
                            <li>cleaning Calgary</li>
                            <li>commercial cleaning Calgary</li>
                            <li>home cleaning Calgary</li>
                            <li>cleaning Calgary services</li>
                            <li>residential cleaning</li>
                            <li>Calgary cleaning services</li>
                            <li>Maid service Calgary</li>
                            <li>Calgary cleaning company</li>
                            <li>quality cleaning services </li>
                            <li>professional cleaning services Calgary</li>
                        </ul>
                        <ul class="services">
                            <li>eco cleaning services</li>
                            <li>house cleaning Calgary</li>
                            <li>eco cleaning services Calgary</li>
                            <li>condo cleaning Calgary</li>
                            <li>scent-free cleaning products Calgary</li>
                            <li>hypo-allergenic cleaning products Calgary</li>
                            <li>environmentally responsible cleaning products Calgary</li>
                            <li>Calgary cleaning</li>
                            <li>Janitorial services Calgary</li>
                            <li>Carpet cleaning Calgary</li>
                            <li>quality cleaning services Calgary</li>
                            <li>Maid Calgary</li>
                        </ul>
                    </div>
                </div>
                </div>
<body>
</body>
</html>

在IE的不同版本之间,我对jquery没有任何兼容性问题。jquery团队在使jquery与所有浏览器兼容方面做了出色的工作。问题很可能出在javascript本身。IE因其处理javascript的问题而臭名昭著

请更具体地说明代码示例以及您遇到的问题

编辑:您的html在body标记之外

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
    <script type="text/javascript" src="js2/jquery-1.7.2.min.js"></script>    
    <script type="text/javascript" src="js2/custom3.js"></script>
</head>
<body>
     Content should go here
</body>
</html>

您在overview链接上有一个空字符串作为
href
。因此,它试图“遵循”到
href
,这显然是不存在的。

请发布您遇到问题的特定代码,并针对每个问题关注一个问题。这将使您的问题更容易回答,并使其在将来可能对其他人有用。正如您在标题中看到的,我使用jquery 172。您的javascript不在脚本标记中,您的内容也在body标记之外。而不是删除活动链接的id属性。我建议使用一个类并添加和删除activeLink的类。这是因为它位于外部页面custom3.jsOk中,但您的html仍然超出了body标记。同时,我已经解决了这个问题,问题出现在overview链接中的href=“”中。如果我把它拿出来,它就像一个符咒。这很奇怪。谢谢你的帮助。另外,在原始代码中,html位于body标记内,您可以查看我发布的链接。我的更新答案应该可以解决您的问题。是的,谢谢,现在它工作正常
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
    <script type="text/javascript" src="js2/jquery-1.7.2.min.js"></script>    
    <script type="text/javascript" src="js2/custom3.js"></script>
</head>
<body>
     Content should go here
</body>
</html>
$('.show').click(function() {
    if($(this).html() == "Overview") {
        $('.Sevices').hide();
        $('.Overview').show();
    }
    else {
        $('.Overview').hide();
        $('.Sevices').show();
    }

    $('.show').removeClass("activeLink");
    $(this).addClass("activeLink";
});