아래 내용을 참고해보자.

http://earthcode.com/blog/2006/01/css_floats_programmatically.html

 

요약하면,

IE에서는 styleFloat, 나머지 cssFloat 를 설정해야 한다.

float로 쓸 수 없는 이유는 예약어와 겹치기 때문이다.

 

Programmatically setting the "float" CSS property in Javascript

IE and Firefox have different ways of doing this, and neither one is what you would expect.

 

In IE, it's myDiv.style.styleFloat="left";

In Firefox, it's myDiv.style.cssFloat="left";

 

Here's a full code block, with primitive browser detection included. This will work in both IE and Firefox:

 

if (document.all) { // very basic browser detection

var sFloat="styleFloat"; //ie

} else {

var sFloat="cssFloat"; //firefox

}

var oMyDiv=document.getElementById("myId");oMyDiv.style[sFloat]="left";

 

http://www.emailonacid.com/blog/details/C13/12_fixes_for_the_image_spacing_in_html_emails

+ Recent posts