Moving DIVs?

G

Gernot Frisch

Hi,


this is where the DIVs of a menu get created:
<div id="menudivs" class="m' + this.container.id + 'l' + this.depth +
'i">'
+ this.fields[0] + "</div>

How do I loop through all of them and move them by "dx" horizontally.
(I want to put this in a window.onresize event handler)

Thank you,

--
-Gernot

Post here, don't email. If you feel you have to mail, revert my
forename from:
(e-mail address removed)
________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
 
T

Thomas 'PointedEars' Lahn

Gernot said:
this is where the DIVs of a menu get created:
<div id="menudivs" class="m' + this.container.id + 'l' + this.depth +
'i">'
+ this.fields[0] + "</div>

How do I loop through all of them and move them by "dx" horizontally.

RTFM. There are two ways:

A) Move each "div" element. Obtain the collection of elements with
document.getElementsByTagName() (W3C), document.all() (IE4+) or
document.layers (NN4), then test against the className property
of each element object.

B) Change the value of the left property in the class selector
(not in NS4 and Opera). Obtain the list of stylesheets for
the document with document.styleSheets and the rules with
the document.styleSheets[...].cssRules (Gecko) or the
document.styleSheets[...].rules (IE) collection.
(I want to put this in a window.onresize event handler)

Oh my. Use a proper stylesheet instead. What if client-side script
support is restricted or disabled or the DOM does not support that at
all? Thought about the user's system resources?


PointedEars

P.S.:
(e-mail address removed) is not a mailbox address ("A mailbox receives mail"):

| (e-mail address removed)
| SMTP error from remote mailer after RCPT TO:<[email protected]>:
| host privacy.net [66.46.181.115]:
| 550 relaying mail to privacy.net is not allowed

Thus using it violates Internet/NetNews standards (RFCs 1036
and 2822). Even if it would receive mail, the automated
response described on the website would still disregard
Usenet Netiquette. So people using privacy.net addresses
are automatically killfiled by me from now on.
See [en] <http://www.interhack.net/pubs/munging-harmful/>
and/or [de] <http://gerlo.de/falsche-email-adressen.html>
for details.

P.P.S.: de.comp.lang.javascript exists.
 
G

Gernot Frisch

RTFM. There are two ways:

Sorry, I don't have TFM. Where do I get it?
A) Move each "div" element. Obtain the collection of elements with
document.getElementsByTagName() (W3C), document.all() (IE4+) or
document.layers (NN4), then test against the className property
of each element object.

Er... OK. I think I understand.
B) Change the value of the left property in the class selector
(not in NS4 and Opera). Obtain the list of stylesheets for
the document with document.styleSheets and the rules with
the document.styleSheets[...].cssRules (Gecko) or the
document.styleSheets[...].rules (IE) collection.

That's not X-browser compatible, right?
Oh my. Use a proper stylesheet instead. What if client-side script
support is restricted or disabled or the DOM does not support that at
all? Thought about the user's system resources?

The onresize is triggered quite often, huh? Can you give me a link to
this approach you suggested? I'm a complete idiot when it comes to
JavaScript.
(e-mail address removed) is not a mailbox address ("A mailbox receives mail"):

Sorry, It's for spam-reasons. Don't mail, post here.
-Geront
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top