Layout: CSS Javascript properties syntax

started by Jwmpc on Jul 10, 2004 — RSS Feed

Jwmpc Jwmpc
Posts: 13

I've been over the "Scripting the Box" feature, which was a great help understanding how javascript can dynamically affect CSS boxes, but I'm a little unclear on how these properties are accessed in a function.

For example the box property of "background" which can have color, position, etc., becomes "backgroundColor" or "backgroundPosition" etc.

If you intended to change the absolute position of a block, would the property be listed as "positionAbsolute"? The intended effect is to have a black box move gradually to the right uncovering elements underneath that can select things. A pseudo-scroll you might call it.

So my first question would be is "positionAbsolute" the correct way to call this property in javascript (ie, = "50,100"? Or am I hopelessly confusing the syntax?

The second question: Is there is a reference that gives the box property spellings and how they relate between the two? I checked the general CSS and Javascript references, but of course they speak only generally of box properties for either subject, and not how they might relate.

I realize that I might be overthinking this, as exact values imply absolute ones, but if you have some experience with this, I'd appreciate your help. I posted this here, rather than in "scripting" because I don't want to know how to do the scripting, just the translation from CSS to Javascript.

Joe Gillespie Joe Gillespie
Posts: 528

The full explanation of the DOM (Document Object Model) can be found here but for what you are trying to do, you don't need to change the absolute position. The div is set to be absolute in your main CSS definitions, from there, you only need to change the top or left attributes.

function moveBox(x,y)
if (document.getElementById)
   var theBox = document.getElementById("box";"px";"px";

Jwmpc Jwmpc
Posts: 13

Thanks! That was what I needed to know (on both questions).

Maskodok Eko Maskodok Eko
Posts: 171

TOP SEO | Jasa SEO Profesional

TOP SEO | Jasa SEO Profesional Agen Texas Poker Dan Domino Online Indonesia Terpercaya IDRPoker.COM Agen Texas Poker dan Domino Online Indonesia Terpercaya Agen Texas Poker Dan Domino Online Indonesia Terpercaya D

Kokokmas Kokokma Kokokmas Kokokma
Posts: 104

You know, Sim City Societies had a lot of potential, it was a great concept that was horribly developed and lacked any kind of depth. The idea of individualize buildings functioning independently playing its role in a largely diverse and thriving city.

The new Sim City appears to be the classic Sim City gameplay we saw with SC4, combined with a far better developed version of the Societies concepts. Looking great guys, don't let us down.

You must login to reply