2014-02-24 41 views
0

我有,其提交的輸入按鈕有一個背景圖像,並在輸入欄的左上角轉移的一種形式:提交輸入IE8無法點擊

enter image description here

這適用於所有的主流瀏覽器。我的問題是,它也需要在Windows XP(!)上的IE8中工作,而不是。當您懸停在輸入(放大鏡)上時,指針不會改變,並且該按鈕不可點擊。任何想法,我要錯了嗎?

HTML:

<form id="" action="" method="post"> 
<label for="search">Search</label> 
<input type="text" id="search" name="search" value="" /> 
<input type="submit" name="searchsub" class="searchsub" value="" /> 
</form> 

CSS:

#search { 
width:222px; 
height:36px; 
padding-left:223px; 
padding-right:10px; 
float:left; 
} 

input.searchsub { 
width:23px; 
height:23px; 
float:left; 
background-image:url(../images/magnifier.jpg); 
margin:8px 0 0 -32px; 
border:0; 
cursor:pointer; 
} 

回答

2

這是一個開始:(演示:http://jsfiddle.net/KYL3A/

我刪除了你的花車,並添加一個div爲「邊境包裝」 。我認爲這會令IE8玩:)雖然我無法測試它自己,因爲我沒有IE8

<form id="" action="" method="post"> 
    <div id="searchwrap">  
     <label for="search">Search</label> 
     <input type="text" id="search" name="search" value="" /> 
     <input type="submit" name="searchsub" class="searchsub" value="" /> 
    </div> 
</form> 

CSS

#searchwrap { 
    display: inline-block; 
    border: 1px solid #333; 
    padding: 0 10px; 
} 
#search { 
    width:150px; 
    height:36px; 
    border:0; 
} 

input.searchsub { 
    width:23px; 
    height:23px; 
    background:red url(); // added red as i dont have your image 
    margin:8px 0 0 0px; 
    cursor:pointer; 
} 
+0

輝煌,它的工作原理,謝謝!我只需要添加'input:focus {outline-width:0; }'在Chrome中刪除輪廓。再次感謝。 – GluePear

-1

如果您在HTML表單中使用按鈕元素,不同的瀏覽器將提交不同的值。 Internet Explorer將提交和標記之間的文本,而其他瀏覽器將提交value屬性的內容。使用輸入元素在HTML表單中創建按鈕。

因此,這是不會在您所說的網頁瀏覽器(IE + XP),因爲該瀏覽器不支持它。你的代碼沒有問題。所以我會說,就這樣離開吧,因爲在XP上運行Internet Explorer的用戶不會很多,但是如果有很多用戶,那麼您可能需要在其中放置一些文本。

來源:this頁和this源第一個答案

+0

我沒有使用過的按鈕元素。 – GluePear

+0

@GluePear如果你不是,爲什麼不嘗試使用它一次? http://stackoverflow.com/questions/9376192/add-icon-to-submit-button-in-twitter-bootstrap-2 ...你說什麼..?對不起,我不是一個高級的HTML程序員 –

+0

恩,因爲你說它在IE8中不起作用? – GluePear

相關問題