HA

i have this style

<div id="diamonds" style="position:absolute; left:0px; top:0px; width:130px; height:255px; z-index:1; visibility: hidden;">

i have a function that changes it with JavaScript

b.left=X_pos;
b.top=Y_pos;
alert('X_pos= '+X_pos+' left= '+b.left+' Y_pos= '+Y_pos+' top= '+b.top);

it changes the left and top to a new number, in IE it sees tghe new number and changes the left and top to the new number, however in firefox it DOES see the new number (it know what X_pos is) but it does not change the style to the new number.... so i guess this is how you change the style in IE so how do i change the style in firefox?

add a comment
0

10 Replies

  • Votes
  • Oldest
  • Latest
KA

Try b.style.left and b.style.top respectively.

add a comment
0
HA

thanks for your reply

b is the actual css style declaration object

if i do this
b.left=255;
b.top=255;
alert(b.top);

IE says : 255px
FF says : 0px

add a comment
0
KA

thanks for your reply

b is the actual css style declaration object

if i do this
b.left=255;
b.top=255;
alert(b.top);

IE says : 255px
FF says : 0px

Ah, wasn't very clear from the code you posted. With firefox, you may have to specify the units concatenated onto the value, i.e.:

b.left = 255 + "px";
b.top = 255 + "px";
add a comment
0
HA

THANK YOU SO MUCH you saved me!...i been trying to many things to figure it out and all i needed to do was add px to the end....whoo

add a comment
0
BO

a good way to make it would be to make more than one stylesheet with different names then use cookies and pull the cookies in with the rel="" in order for it to catch the correct stylesheet, doign it this way will make it compatable on all browsers, many browsers fail to work with some JavaScript things

add a comment
0
KA

a good way to make it would be to make more than one stylesheet with different names then use cookies and pull the cookies in with the rel="" in order for it to catch the correct stylesheet, doign it this way will make it compatable on all browsers, many browsers fail to work with some JavaScript things

I don't think that's anything to do with halfasleep' problem. He's changing the content of his page dynamically using JavaScript - not something you can do with CSS files.

add a comment
0
HA

a good way to make it would be to make more than one stylesheet with different names then use cookies and pull the cookies in with the rel="" in order for it to catch the correct stylesheet, doign it this way will make it compatable on all browsers, many browsers fail to work with some JavaScript things

I don't think that's anything to do with halfasleep' problem. He's changing the content of his page dynamically using JavaScript - not something you can do with CSS files.

correct bc i am setting a drop down menu to be placed right under the button that calls it. it used to be a static x and y but i made it so i can move the button around and the drop down menu follows it.

[OT]
katana, lol @ the thing in your sig 31 Oct = 25 Dec, thats clever
[/OT]

add a comment
0
BO

katana, lol @ the thing in your sig 31 Oct = 25 Dec, thats clever

:S i still do not understand that partiular joke and or pun and i am also speaking exactly in this specific way because the moderator seems to hate the occasional l - o - l (ok enough of that not... sort of taking it too far) well ehm im pushign it now lol. but ehm an incident happened a few minutes ago about the chatspeak...

ok back to the matter at hand, maby i should pm about this but ill embarass myself here... i sont understand ur signature. is it somethign to do with the time / date functions or something? lol

ok and sorry about what i said highlighted in the quote in the quote then confirmed by the person who made the seccond set of quotes. i jumped to conclusions, user-custom styles are a common thing people ask for.

add a comment
0
KA

Oct is shorthand for Octal, which is base-8. Dec is short for Decimal. 31 Octal = (3*8 )+1 which is equal to 25 Decimal.
Haven't you covered different bases in computing at school?

add a comment
0
BO

nope not at all... and im in the highest possible class at school... hmmm... but i am very good at visual basic... which they tought TOO much lol.

edit:
guess that means im not a geek then lol 🙄 althoguth...

add a comment
0