CSS is used to style HTML elements such as layering and positioning the content
wheather u have to learn another language?
There are a couple of important points that you should be aware of when you are working with the DHTML client during application development.
Here’s a simple demonstration. the text below change color when the mouse moves over it:
Move your mouse here
The code looks like:
onMouseout=”sometext.style.color=’black'”>Move your mouse here <span/>
In order to get this effect, I first gained access from the element’s ID. Then, through the style object, and finally the style’s color property. All style properties are read/write, and are accessed in a similar manner: element id->style object->property name.
you can do something like
element.style.color = ‘#00cc00’;
as soon as this bit of script is executed the text colour changes from red to green.
and then change its left:
element.style.left = 200;
Now element magically moves to 200 pixels from the left margin of the page.
The style property
So generally,you first go to the HTML element in Internet Explorer you want to influence like :-
document.all[‘tobechanged’].style.left = 200;
then change the style declarations:
If you want to change color, styleDeclaration is color, if you want to change the left, it is left. If you want to change a style declaration with a dash in it, for instance z-index, remove the dash and make the first letter after the dash a capital: zIndex. Same for margin-left => marginLeft.
Note that the style property reflects the inline styles of the element. This is important if you want to read out the styles of the element. If you try to read out the color of the paragraph:
You get an empty alert. This is because the P doesn’t (yet) have an inline color style. The style defined by p#testP is not readable through the style property.
You define your styles inline, it works fine