2011-05-24 31 views
0

我有這個代碼,它適用於Chrome和Firefox,但在IE上只顯示第二個背景圖片...你知道爲什麼嗎?爲什麼多個背景圖片不適用於IE?

$('input[type=button]').click(function() { 
    //search for the button 
    var button = document.getElementsByName("contactme"); 
    //change the image 
    button[0].style.background = "url(http://www.restorationsos.com/imgs/loader.gif) no-repeat, url('http://www.restorationsos.com/imgs/btnBG.gif') repeat-x"; 
    //change the text 
    button[0].value = "We Are Connecting You..."; 
    button[0].style.textAlign = "right"; 
    button[0].style.color = "#ea2400"; 
    //disable the button 
    button[0].disabled = true; 
}); 

直播:http://jsfiddle.net/cristiboariu/pUeue/21/

+0

哪個IE版本。反正檢查:http://stackoverflow.com/questions/423172/can-i-have-multiple-background-images-using-css – roberkules 2011-05-24 19:24:45

+3

多背景圖像在一個單一的背景聲明是一個CSS3事情。任何低於8的IE都會有超級糟糕的CSS支持。 – 2011-05-24 19:25:16

回答

0

嘗試添加CSS屬性

zoom:1;
在IE7中,這使得背景圖像奇蹟般地出現。不要問我爲什麼,它只是。

+0

我添加了這個:'button [0] .style.zoom =「1」;'並且問題依然存在...... – 2011-05-24 19:28:36

+0

沒有在您的代碼上滾動以查看您試圖將兩個背景圖像放在一個DIV。對於那個很抱歉 – locrizak 2011-05-24 19:56:54

相關問題