문제

페이지에 작은 div가 팝업되는 스크립트가 있습니다. 그것은 모두 즉, DocType를 제거하면 FF에서 잘 작동하지만 DocType가 XHTML/Transitional 일 때 Firefox에서는 폭이 변하지 않습니다.

this.container.style.visibility = "visible";
alert("this.container.style.width before = " + this.container.style.width)
this.container.style.width = this.width;
alert("this.container.style.width after = " + this.container.style.width); 
this.container.style.height = this.height;

IE와 DocType가없는 FF에서 첫 번째 경고는 0이라고 말하고 두 번째 경고는 320이라고 말합니다 (코드의 다른 곳에 설정된 너비입니다).

ff에서, doctype에서 xhtml/transitional이 있으면 두 경고 모두 0이 표시됩니다. 여기서 무슨 일이 일어나고 있는지 아는 것이 있습니까? 나는 DIVS에서 과도기적으로 위치를 명시 적으로 설정해야 할 수도 있다고 생각하지만 확실하지 않습니다.

도움이 되었습니까?

해결책

설정을 시도 했습니까?

this.container.style.visibility = "visible";
alert("this.container.style.width before = " + this.container.style.width);
this.container.style.width = this.width + 'px';
alert("this.container.style.width after = " + this.container.style.width);
this.container.style.height = this.height + 'px';

//Note the 'px' above

단위없이 숫자의 너비/높이를 설정하려고하면 문제가 발생할 수 있습니다.

다른 팁

당신이 사용할 수있는:

document.getElementById("td").style.visibility="hidden";
document.getElementById("td").style.display="none";

너비 속성 대신.

효과가있다!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top