我在設置某些東西在JS中浮動時遇到了問題。我的代碼如下:從Javascript設置浮點數值
var closebutton = document.createElement('div');
closebutton.style.styleFloat = "right";
alert(closebutton.style.styleFloat);
closebutton.style.background = "#f00";
closebutton.innerHTML = '<a href="">✖</a>';
titlebar.appendChild(closebutton);
元素的背景確實是紅色的,並且當加載頁面警告「正確」時。然而,div並沒有正確地浮動。 Firebug沒有顯示浮標的痕跡。錯誤控制檯中沒有錯誤或警告。
我很難過!
更新:
至於建議,我自己也嘗試:
closebutton.style.float = 'right';
這也不起作用,並強調了鮮紅的在我的文本編輯器(gedit中)
那些話在我腦海中的那一刻,我看到了問題標題 - 你是一個遠程MIND-讀者! :) – Latze 2010-08-09 22:02:46