0

我的網站在我的Mac和iPhone上運行良好,但在IE中卻沒有。在IE中,某些導航欄功能不正確(即佈局不正確,搜索框沒有佔位符文本,其中一個導航欄元素(收藏夾)看起來完全不同)。我不知道問題出在哪裏網站無法在所有瀏覽器上運行

佈局/ application.html.erb是

<!DOCTYPE html> 
<html> 
<head> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 

    <%= analytics_init if Rails.env.production? %> 
    <title>Guidelines for Me</title> 

    <%= stylesheet_link_tag "application", :media => "all" %> 

    <%= javascript_include_tag "application" %> 
    <link href="../assets/bootstrap-responsive.css" rel="stylesheet"> 
    <%= csrf_meta_tags %> 

    <script type="text/javascript"> 
function clearDefault(el) { 
if (el.defaultValue==el.value) el.value = "" 
} 
function clearText(){ 
    search = $('.search-query'); 
    if (search.defaultValue==search.value) 
    search.value = "" 
} 
type="text/javascript"> 
$(document).ready(function() { 
    $('.collapse').collapse(); 
}); 


</script> 
</head> 
<body> 

    <div class="navbar navbar-inverse navbar-fixed-top"> 
     <div class="navbar-inner"> 
      <div class="container"> 
       <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> 
       <span class="icon-bar"></span> 
       <span class="icon-bar"></span> 
       <span class="icon-bar"></span> 
       </a> 

       <% if Guideline.count % 100 ==0 %> 
        <%= link_to "#{Guideline.count}" " guidelinesforme - yay!", guidelines_path, :class => 'brand' %> 
       <% else %> 

        <%= link_to "#{Guideline.count}" " guidelinesforme!", guidelines_path, :class => 'brand' %> 
       <% end %> 



      <div class="nav-collapse in collapse"> 
       <ul class="nav"> 
        <li class="dropdown"> 
         <a href="#" class="dropdown-toggle" data-toggle="dropdown"> 
         List by... 
         <b class="caret"></b> 
         </a> 


        <ul class="dropdown-menu"> 
         <li><%= link_to "...Topic", topics_path %></li> 
         <li><%= link_to "...Organisation", hospitals_path %></li> 
         <li><%= link_to "...Specialty", specialties_path %></li> 
         </li> 
        </ul> 

        <% if user_signed_in? %> 
         <li><%= link_to "Favourites", favourites_path %></li> 
        <% else %> 
         <li><%= link_to "Favourites", register_path %></li> 
        <% end %> 
       </ul> 

       <ul class="nav pull-right"> 
       <li class="dropdown"> 
        <a href="#" class="dropdown-toggle" data-toggle="dropdown"> 
        <% if user_signed_in? %> 
         <%= current_user.first_name %> 
        <% else %> 
         Log in or Sign up 
        <% end %> 
        <b class="caret"></b> 
        </a> 


       <ul class="dropdown-menu"> 

        <% if user_signed_in? %> 
         <li ><%= link_to "Edit profile", edit_path %></li> 
         <li> <%= link_to "Log out", logout_path %></li> 
        <% else %> 
         <li><%= link_to "Log in", login_path %></li> 
         <li><%= link_to "Sign Up", register_path %></li> 
        <% end %> 

        <li><%= link_to "About us", about_path %></li> 
        </li> 
       </ul> 

       </li> 




        <li > 
        <%= form_tag guidelines_path, :class => 'navbar-search', :onSubmit=>"clearText(this)",:method => :get do %> 

        <%= text_field_tag :search, params[:search], :class => 'search-query input-small', :placeholder=>"Search", :ONFOCUS=>"clearDefault(this)" %> <% end %> 
        </li> 

       </ul> 
      </div> 
      </div> 
     </div> 
    </div> 

    <div class="container"> 

     <% flash.each do |type, message| %> 

      <div class="alert <%= flash_class type %>"> 
       <button class="close" data-dismiss="alert">x</button> 
       <%= message %> 
      </div> 
     <% end %> 
    </div> 

    <div class="container"> 
     <%= yield %> 
    </div> 


</body> 

</html> 

我使用Twitter的引導。

我確實添加了

<!-- HTML5 shim, for IE6-8 support of HTML5 elements --> 
<!--[if lt IE 9]> 
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> 
<![endif]--> 
我以前

,但似乎不有所作爲。

+2

歡迎來到稱爲IE – 2013-03-05 06:56:06

+0

的恐怖哈!好,可以。所以我應該把它吸起來? – tessad 2013-03-05 06:56:49

+0

可以請你在IE中顯示你看到的菜單項的佈局變化.. – Shail 2013-03-05 08:02:11

回答

0

直到IE9才支持首先佔位符。但是你可以使用javascript pollyfills來啓用佔位符支持,爲此使用http://www.modernizr.com/

相關問題