2013-01-03 49 views
1

下面的代码是没有被正确拾起IE 10的jQuery只需通过IE10和整个表单忽略HTML表单的头部即使它在jQuery代码中明确指示它不应该显示。这段代码完全可以在firefox/chrome/IE9/Safari下运行。这只是造成这个问题的IE10。非常感谢jQuery脚本在Firefox和Chrome,但工作不拿起即10

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <title>company</title> 
    <meta charset="utf-8"> 
    <link rel="stylesheet" href="css/style.css" type="text/css"> 
    <script src="js/jquery-1.6.4.min.js" type="text/javascript"></script> 
    <script src="js/script.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      /*Hiding the form */ 
      $(".1").css("display", "none"); 
      $(".2").css("display", "none"); 
      $(".3").css("display", "none"); 
      $(".4").css("display", "none"); 

      function goToByScroll(id){ 
       $('html,body').animate({scrollTop: $("#"+id).offset().top},'bottom'); 
      } 

      $("input:radio[name=query-form][disabled=false]:last").attr('checked', true); 

      $("input:radio[name=query-form]").click(function() { 
       $(".1").css("display", "none"); 
       $(".2").css("display", "none"); 
       $(".3").css("display", "none"); 
       $(".4").css("display", "none"); 

       $("#country").click(function() { 
        $("html, body").animate({ scrollTop: $(document).height() }, "slow"); 
        return false; 
       }); 

       goToByScroll("country"); 
       if ($("#option1").is(":checked")) 
        $(".1").show("fast"); 
       else if ($("#option2").is(":checked")) 
        $(".2").show("fast"); 
       else if ($("#option3").is(":checked")) 
        $(".3").show("fast"); 
       else if ($("#option4").is(":checked")) 
        $(".4").show("fast"); 

      }); 
     });  
    </script> 

    <!--[if lt IE 8]> 
     <div style='clear:both; text-align:center; position:relative;'><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" alt="" /></a></div> 
    <![endif]--> 
    <!--[if lt IE 9]> 
     <script type="text/javascript" src="js/html5.js"></script> 
     <link rel="stylesheet" href="css/ie.css" type="text/css" media="screen"> 
    <![endif]--> 
</head> 

我们解决了这个问题与本以前的代码,现在就可以请你告诉我,为什么这个下面的代码是不是在IE10工作。这与上面非常相似,但是,这次我们正在处理下拉菜单。这个代码再次在所有其他浏览器中都能找到。 IE10似乎真的很迂腐。

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <title>Company</title> 
    <meta charset="utf-8"> 
    <link rel="stylesheet" href="css/style.css" type="text/css"> 
    <script src="js/jquery-1.6.4.min.js" type="text/javascript"></script> 
    <script src="js/script.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      /*Hiding the form */ 
      $(".install_download").css("display", "none"); 
      $(".hosted_install").css("display", "none"); 
      $(".reseller_install").css("display", "none"); 

      function goToByScroll(id){ 
       $('html,body').animate({scrollTop: $("#"+id).offset().top},'bottom'); 
      } 

       goToByScroll("country"); 

       $(".subject_category").change(function(){ 

        $(".install_Download").css("display", "none"); 
        $(".hosted_install").css("display", "none"); 
        $(".reseller_install").css("display", "none"); 

        switch ($(".subject_category option:selected").text()) {     
         case "General Enquiry": 
          $(".General_Enquiry").show("fast"); 
          break; 
         case "Install/Download": 
          $(".install_download").show("fast"); 
          goToByScroll("message"); 
          break; 
         case "Hosted Install": 
          $(".hosted_install").show("fast"); 
          goToByScroll("message"); 
          break; 
         case "Solution Provider - Install": 
          $(".reseller_install").show("fast"); 
          goToByScroll("message"); 
          break; 
        } 
       }); 
     });  
    </script> 

    <!--[if lt IE 8]> 
     <div style='clear:both; text-align:center; position:relative;'><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" alt="" /></a></div> 
    <![endif]--> 
    <!--[if lt IE 9]> 
     <script type="text/javascript" src="js/html5.js"></script> 
     <link rel="stylesheet" href="css/ie.css" type="text/css" media="screen"> 
    <![endif]--> 
</head> 
+0

数字类名? '在CSS中,标识符(包括元素名称,类和选择器中的ID)只能包含字符[a-z0-9]和ISO 10646字符U + 00A1及更高版本,以及连字符( - )和下划线(_ );他们不能以数字或连字符后跟数字开头。标识符也可以包含转义字符和任何ISO 10646字符作为数字代码(参见下一项)。例如,标识符“B&W?”可以写成“B \&W \?”或“B \ 26 W \ 3F”。更多这里http://stackoverflow.com/questions/448981/what-c​​haracters-are-valid-in-css-class-names – alexbusu

回答

3

基本上CSS类名,必须以下划线(_),破折号( - )或字母(A-Z),而不是一个号码作为你的情况,后面跟上任意数量破折号,下划线,字母或数字。还有一个问题:如果第一个字符是一个破折号,第二个字符必须是字母或下划线,并且名称必须至少2个字符长:

-?[_a-zA-Z]+[_a-zA-Z0-9-]* 

标识符以短线或下划线通常为浏览器特定的扩展保留,如-moz-opacity

这一切都取得通过包含转义Unicode字符(没有人真正使用)有点复杂。

。注意,根据CSS grammar,规则开始以两个破折号,例如--indent1,无效。但是,我很确定我在练习中已经看到了这一点。

+0

+1 - 另见http:// stackoverflow.com/questions/448981/what-c​​haracters-are-valid-in-css-class-names – jantimon

+1

对不起,我忘了在正确的地方更改名称。它现在工作得很好。非常感谢您的准确回答,并对我的错误表示歉意:-) – Sam

相关问题