在這example鉻設置背景紅色,Firefox和IE不。如何讓firefox使用style ['attribute-name'] =設置樣式屬性?
嘗試:
document.getElementById("firefoxDiv").style['backgroundColor'] = "Red";
和
document.getElementById("firefoxDiv").style['background-color'] = "Red";
background-color
VS直列使用JavaScript .style.backgroundColor =
感謝我寧願能夠使用外部CSS中使用相同的語法您幫幫我!
注意:否 jQuery請。
@ZoltanToth我很困惑,如果你讀過這個問題嗎? – jeremy