看板 Ajax 關於我們 聯絡資訊
其實有點不知道怎麼下標題 主要問題是這樣的 我的畫面上有一個藍色背景色的div 我使用js將div的背景色變更為綠色 然後顯示一個message box 在windows的IE, Safari, Chrome上 當message box彈出時, div的背景色已經是綠色了 (變更後) 在MAC OS上, Chrome的結果同上 但在Safari上, message box彈出時 div的背景色還是藍色 (尚未變更) 直到關閉message box, div的背景色才變更 請問有人知道為什麼會有這樣的差異嗎 要怎麼樣修正才能讓MAC上的Safari 在message box彈出時 div背景色已經變更了 完整的程式如下: <html> <head> <title></title> <script language="javascript"> function fnChnageColor() { document.getElementById("divTest").style.backgroundColor = "#00FF00"; alert("OK"); } </script> </head> <body> <form> <div id="divTest" style="background-color:#0000FF; width:50px; height:50px;"></div> <input name="btnChangeColor" id="btnChangeColor" value="Change background color" onclick="fnChnageColor();" type="button" /> </form> </body> </html> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.128.103.205
YUPTT:http://jsfiddle.net/2LgkW/1/ 用 jQuery吧 05/03 23:36