views:

30

answers:

2

i have js cript

var lf = -10;
if(lf < 0 )
$("element").setStyle({left:(parseInt(lf)+10)+'px'});

this lot very strange

(parseInt(lf)+10) = - 20;

in opera

Version 10.62

Build 6438

Platform Linux

System x86_64, 2.6.31-22-generic

in all another browser (parseInt(lf)+10) = 0;

How it can be ?

+1  A: 

I'm not seeing that behavior, either in the latest Opera for Linux (10.62 build 6438) or for Windows (10.62 build 3500):

Initial test case: http://jsbin.com/onahe3/2

Further test case: http://jsbin.com/onahe3/4 (more like your original)


2010/09/19: Responding to your note below (that really should be an update to the question, not an answer), I'm just not seeing that behavior, on Opera or otherwise: http://jsbin.com/ijozo3/2 There's something else wrong somewhere else.

T.J. Crowder
in you script -10 + (-10) try -10 + 10
Alehandro
@Alehandro: Wow do I need more coffee. :-) Fixed (and answer edited), but I'm getting the expected result (0) on both Linux and Windows.
T.J. Crowder
Check that in windows gives -10+10 = 0( This bugs only my browser ?on linux
Alehandro
Same result on 10.61 and 10.62 Win.
Andy E
Thanks T.J. Crowder
Alehandro
@Alehandro: No worries, sounds like you might want to uninstall and reinstall Opera. :-)
T.J. Crowder
i hope this help :)
Alehandro
A: 

Problem not solved this full code function it runing when mouseover in div with interval 10ms it using prototype in all another browsers work fine but not on opera ((

function openMenu(){
                var pleft = $("slidemenubar2").getStyle("left");

                if(parseInt(pleft) < 0){
                    $("slidemenubar2").setStyle({left: (parseInt(pleft)+10)+'px'});
                    alert($("slidemenubar2").getStyle("left"));//always <0
                }
            }

how it can be ?( don't anderstand.

Alehandro
This should be an **edit** of the question, not an answer.
T.J. Crowder
I've updated my answer to respond to the above. Just not seeing that behavior.
T.J. Crowder