![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Okay, Folks, I guess my real burning concern all along is a "high-level" one: just how does JavaScript interact with CSS? |
|
Right now, my newbie self only knows JavaScript and CSS to *co- exist*...but I'm beginning to get the sense that they actually interact -- or, perhaps more precisely, JavaScript acts upon CSS...but how, exactly?? I see how JavaScript acts upon HTML, but I'm not so sure where JavaScript acts upon CSS...moreover, I want to see where they could create whole new browsing experiences, beyond simply new text and new images (though I'm only just beginning at the level of new ways of presenting text and images).... |
#2
| ||||
| ||||
|
| Depends on what level of "interaction" you're specifying. Direct manipulation of style rules is handled by something called the `CSS Object Model' (still a WIP, IIRC); but computed style rules can be affected by DOM mutations. It is the latter that is more often the case. |
|
In short, most JavaScript tends to act on CSS only by proxy through the HTML. In my code, I generally modify styles by changing the classes of elements. |
|
P.S. The `DOM', or `Document Object Model', is the precise specification that most people think of when the think of JavaScript; any time you're dynamically modify DOM (e.g. through document.getElementByID), you're actually using the DOM. Most literature tends to gloss over this distinction. |
|
-- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth |
![]() |
| Thread Tools | |
| Display Modes | |
| |