[Javascript] dynamically reading/changing values in a css class from javascript
Troy III Ajnej
trojani2000 at hotmail.com
Thu Jun 14 22:54:27 CDT 2007
it is impossible to change the CSS itself. Eventhough you can assign
a different value for some property of an element through javascript,
it is done via inline css, meaning that the body of css remains uncha-
ged. Only the HTML code will change.
exmp.
your code:
<DIV class=navPanel>..</DIV>
resulting code after js manipulation:
<DIV class=navPanel style="width:561px">..</DIV>
So, it is posible for you to read css and change values of properties
inlined but if your script statement says this.style.width="" the res-
ulting width of that element will return to it's original value as it exists
in the style body but not undefined.
(As I recall from my last check on this, few years ago).
Regards~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Date: Thu, 14 Jun 2007 12:18:24 +0100From: lbettridge at twowaytv.co.ukTo: javascript at LaTech.eduSubject: [Javascript] dynamically reading/changing values in a css class from javascript
Is it possible to read a value from a CSS class and assign it to a javascript variable ? and then in turn change the value in the CSS class from javascript?
Eg.
In CSS file
.navPanel
{
position: absolute;
background: url(gfx/panel.png) no-repeat;
top: 325px;
left: 39px;
width: 561px;
height: 124px;
z-index: 2;
visibility: hidden;
}
in Javascript file
var width = [somehow read the .navPanel.width value]-- Two Way TV is the trading name of Two Way Media LtdCompany Number: 4904168
_________________________________________________________________
Make every IM count. Download Windows Live Messenger and join the i’m Initiative now. It’s free.
http://im.live.com/messenger/im/home/?source=TAGWL_June07
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070615/4e956a87/attachment.htm>
More information about the Javascript
mailing list