SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: z-index css
Hybrid View
-
Aug 20, 2003, 03:25 #1
- Join Date
- Jun 2003
- Location
- liverpool
- Posts
- 9
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
z-index css
i'm using this
div.left = parseInt(div.left)-100;
in a script
so change position of a div
so why can't i use this
div.z-index = parseInt(div.z-index)-100;
to change it's z-index
any help appriciated
Phil
-
Aug 20, 2003, 13:41 #2
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
That should be zIndex, because div.z-index would treat the "-" as the subtraction operator and try to subtract a variable named "index" from div.z
ck :: bringing chris to the masses.
-
Aug 20, 2003, 13:43 #3
You should also be using [divID].style.left and [divID].style.zIndex to call the properties rather than directly calling left and z-index.
-
Aug 21, 2003, 00:59 #4
- Join Date
- Jun 2003
- Location
- liverpool
- Posts
- 9
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
cheers to first reply - didn't think of that, but i thought you had to use z-index cos that was it's name, so zIndex is cool yes.
And second reply i have already put the divID into a variable so i am assuming that what you said is unnecessary - but thank none the less.
-
Aug 21, 2003, 12:06 #5
You should be doing something like this:
Code:var theDiv = document.getElementById("blah") var myLeft = theDiv.style.left; var myZ = theDiv.style.zIndex;
HTML Code:<div id="blah"></div>
-
Aug 22, 2003, 01:28 #6
- Join Date
- Jun 2003
- Location
- liverpool
- Posts
- 9
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You are gonna have to excuse my stupidity - i've changed it to what you said, but now it won't even change the y pos
http://www.philspeakman.com/test/divZ.htm
i get the theory but am not to practised in dhtml - hence me wanting to learn, if you can shed any more light i would appriciate it, Phil
Bookmarks