質問

私は、ページ上のポップアップ小さなDIVをアニメーション化するスクリプトを持っています。これは、すべてのIEで正常に動作し、FFに私はDOCTYPEを削除する場合は、しかし、DOCTYPEは、Firefoxで暫定XHTML /、あるとき、幅は変更されません。

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で、暫定XHTML /にDOCTYPEで、両方のアラートが0にここで何が起こっているか任意のアイデアを示して?私は明示的に移行してdiv要素の位置を設定する必要があります考えていますが、私はよく分かりません。

役に立ちましたか?

解決

あなたが設定しようとしたことがあります:

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";

の代わりにwidthプロパティのます。

これは動作します!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top