Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help me with a bug in 0.9.7

0 views
Skip to first unread message

Dennis

unread,
Dec 22, 2001, 3:03:32 PM12/22/01
to
I am some element create by code,
var o=document.createElement('div');
document.body.appendChild(o);

If I set
o.style.width or o.style.height
before setting o.style.position, position does not work!!!!!!!

o.style.width='auto';
o.style.position='absolute'; # It is not working!!!!!
o.style.left="100px";
o.style.top="100px";

But, if the set position first,
o.style.position='absolute'; # Everything all right
o.style.width='auto';
o.style.left="100px";
o.style.top="100px";


--
Dennis
======
Homepage(chinese)
http://hkdennis2k.virtualave.net

Dennis

unread,
Dec 23, 2001, 4:16:56 AM12/23/01
to
Here are my example the 3rd one not working

var aa=document.createElement('div');
aa.style.position="absolute";
aa.style.left='100px';
aa.style.top='100px';
aa.innerHTML=1
document.body.appendChild(aa);

var bb=document.createElement('div');
document.body.appendChild(bb);
bb.style.position="absolute";
bb.style.left='200px';
bb.style.top='200px';
bb.innerHTML=2

var cc=document.createElement('div');
document.body.appendChild(cc);
cc.style.position="absolute";
cc.style.width="100px";
cc.style.height="100px";
cc.style.left='300px';
cc.style.top='300px';
cc.innerHTML=3

JS

unread,
Dec 25, 2001, 4:25:47 PM12/25/01
to
Dennis wrote:

> Here are my example the 3rd one not working
>
> var aa=document.createElement('div');
> aa.style.position="absolute";
> aa.style.left='100px';
> aa.style.top='100px';
> aa.innerHTML=1
> document.body.appendChild(aa);
>
> var bb=document.createElement('div');
> document.body.appendChild(bb);
> bb.style.position="absolute";
> bb.style.left='200px';
> bb.style.top='200px';
> bb.innerHTML=2
>
> var cc=document.createElement('div');
> document.body.appendChild(cc);
> cc.style.position="absolute";
> cc.style.width="100px";
> cc.style.height="100px";
> cc.style.left='300px';
> cc.style.top='300px';
> cc.innerHTML=3
>
>
>

Please direct these issues to : news.mozilla.org

Thank you.

Mo

unread,
Dec 27, 2001, 9:28:29 AM12/27/01
to
An alternate code I use that works is:

if(v_ns6up || v_ie6up)
{
var container = document.createElement("div");
container.innerHTML = myContent;
container.setAttribute("class", myClassName);
container.setAttribute("id", myName);
document.body.appendChild(container);
}

I rearranged the last 4 lines in multiple ways and it still seemed to
work. Not sure about your code though.

-Mo

0 new messages