1

請參閱this jsFiddle示例。我已經在文本中使用的背景圖片將拿出來看在IE中,當你在長值類型:在IE 6和IE 7中推出的文本框背景圖片

enter image description here

解決方案(萬一的jsfiddle被刪除)

CSS

#txt_services_by_zip_code_search{ 
    border: none; 
    float: left; 
    height: 22px; 
    width: 95px; 
    padding:0 5px; 
    background: transparent 
} 
#txt_services_by_zip_code_search_wrapper { 
    background: transparent url('http://i.imgur.com/quh2W.gif') no-repeat 0 -25px; 
    display: inline-block; 
    *display: inline; 
    zoom: 1 
} 

HTML

<div id="txt_services_by_zip_code_search_wrapper"> 
    <input type="text" name="services_by_zip_code_search" id="txt_services_by_zip_code_search" class="txt_services_by_zip_code_search" /> 
</div> 
+1

你的問題是什麼? – BoltClock

+0

當您輸入長整型值時,我在文本框中使用的背景圖像在IE中將視圖推出。如何解決該錯誤? – Jaspero

回答

1

一個經典的IE bug ..

有沒有乾淨的解決方法。您必須將輸入封裝在另一個元素中,例如div,然後將background應用於該元素。

見IE7:http://jsfiddle.net/P47sa/3/

這裏是互聯網上的隨機頁面,同意我的看法:http://blogs.creative-jar.com/post/Input-backgrounds-scrolling-in-IE.aspx

如果您的網頁使用了大量的JavaScript/jQuery的,你可以用它來應用修復而不是混淆HTML。

+0

謝謝#thirtydot – Jaspero