FF error?

Discussion in 'Javascript' started by sara, Jun 10, 2009.

  1. sara

    sara Guest

    Hi at all,
    please take a look here.
    I have:
    <body onload="STT();">
    <div id="panorama" style="width:100%; height:150px; border:1px solid
    red;overflow:hidden">
    <img src="images/veylargeimage.jpg" alt="" /></div>
    This js code move automatically image up or down, left or right.
    It work fine wirh MSIE, Opera, Safara and Chrome but not
    with FireFox
    Why please?
    var rollo;
    var b=1;
    var c=1;
    function STT()
    {
    setInterval(function(){rollo=document.getElementById('PANORAMA');rollo.scrollTop+=b;rollo.scrollLeft+=c;if
    (rollo.scrollTop==450){b=-1;}if (rollo.scrollTop==300){b=1;}if
    (rollo.scrollTop==355){c=-1;}if (rollo.scrollTop==450){c=1;}}, 40);}
    sara, Jun 10, 2009
    #1
    1. Advertising

  2. sara wrote:
    > please take a look here. [...]


    Make it worth a look first. That includes, but is not limited to,
    posting with a From header that observes the posting conventions.
    Until then, consider yourself killfiled.

    <http://jibbering.com/faq/#posting>


    PointedEars
    Thomas 'PointedEars' Lahn, Jun 10, 2009
    #2
    1. Advertising

  3. sara

    Stevo Guest

    sara wrote:
    > Hi at all,
    > please take a look here.
    > I have:
    > <body onload="STT();">
    > <div id="panorama" style="width:100%; height:150px; border:1px solid
    > red;overflow:hidden">
    > <img src="images/veylargeimage.jpg" alt="" /></div>
    > This js code move automatically image up or down, left or right.
    > It work fine wirh MSIE, Opera, Safara and Chrome but not
    > with FireFox
    > Why please?
    > var rollo;
    > var b=1;
    > var c=1;
    > function STT()
    > {
    > setInterval(function(){rollo=document.getElementById('PANORAMA');rollo.scrollTop+=b;rollo.scrollLeft+=c;if
    > (rollo.scrollTop==450){b=-1;}if (rollo.scrollTop==300){b=1;}if
    > (rollo.scrollTop==355){c=-1;}if (rollo.scrollTop==450){c=1;}}, 40);}


    Usually if something dealing with DIVs is working on everything except
    Firefox, it can be because FF needs +"px" adding when assigning a value
    that is in pixels. I don't know if it applies here. Try
    rollo.scrollTop=(rollo.scrollTop+b)+"px" for example. Same for scrollLeft.

    Don't worry about Thomas, he thinks everyone should use a valid email
    address for posting here, and he thinks it says so in the group FAQ but
    it doesn't. He's welcome to increase his spam input, but there's no need
    for the rest of us to. This is a newsgroup. Replies are sent to the
    group, so there's no value in using a real email address. If it was
    enforced, then people would just create a dummy gmail/yahoo/hotmail
    account and never bother looking at it, so what's the point.
    Stevo, Jun 10, 2009
    #3
  4. Sara wrote:

    > <div id="panorama">

    ^^^^^^^^

    > setInterval(function(){
    > rollo=document.getElementById('PANORAMA');

    ^^^^^^^^

    I'm surprised, this works in any browser.
    Matthias Reuter, Jun 10, 2009
    #4
  5. sara

    Stevo Guest

    Matthias Reuter wrote:
    > Sara wrote:
    >
    >> <div id="panorama">

    > ^^^^^^^^
    >
    >> setInterval(function(){
    >> rollo=document.getElementById('PANORAMA');

    > ^^^^^^^^
    >
    > I'm surprised, this works in any browser.


    Why?
    Stevo, Jun 10, 2009
    #5
  6. Stevo wrote:

    > Matthias Reuter wrote:
    >> Sara wrote:
    >>
    >>> <div id="panorama">

    >> ^^^^^^^^
    >>
    >>> setInterval(function(){
    >>> rollo=document.getElementById('PANORAMA');

    >> ^^^^^^^^
    >> I'm surprised, this works in any browser.

    >
    > Why?


    Because ids are case sensitive.
    Matthias Reuter, Jun 10, 2009
    #6
  7. sara

    Stevo Guest

    Matthias Reuter wrote:
    > Stevo wrote:
    >
    >> Matthias Reuter wrote:
    >>> Sara wrote:
    >>>
    >>>> <div id="panorama">
    >>> ^^^^^^^^
    >>>
    >>>> setInterval(function(){
    >>>> rollo=document.getElementById('PANORAMA');
    >>> ^^^^^^^^
    >>> I'm surprised, this works in any browser.

    >>
    >> Why?

    >
    > Because ids are case sensitive.


    Ah, sorry, I hadn't spotted that.
    Stevo, Jun 10, 2009
    #7
  8. sara

    sara Guest

    "Thomas 'PointedEars' Lahn"

    wrote:


    > Make it worth a look first. That includes, but is not limited to,
    > posting with a From header that observes the posting conventions.
    > Until then, consider yourself killfiled.
    >
    > <http://jibbering.com/faq/#posting>
    >
    >
    > PointedEars
    >


    Mentre il saggio indica la luna.............

    ..............lo stolto guarda il dito !
    sara, Jun 10, 2009
    #8
  9. Stevo <> writes:

    > sara wrote:
    >> Hi at all,
    >> please take a look here.
    >> I have:
    >> <body onload="STT();">
    >> <div id="panorama" style="width:100%; height:150px; border:1px solid
    >> red;overflow:hidden">
    >> <img src="images/veylargeimage.jpg" alt="" /></div>
    >> This js code move automatically image up or down, left or right.
    >> It work fine wirh MSIE, Opera, Safara and Chrome but not
    >> with FireFox
    >> Why please?


    >> var rollo;
    >> var b=1;
    >> var c=1;
    >> function STT()
    >> {
    >> setInterval(function(){rollo=document.getElementById('PANORAMA');rollo.scrollTop+=b;rollo.scrollLeft+=c;if


    The "PANORAMA" here should be "panorama". Id's are case sensitive.

    >> (rollo.scrollTop==450){b=-1;}if (rollo.scrollTop==300){b=1;}if
    >> (rollo.scrollTop==355){c=-1;}if (rollo.scrollTop==450){c=1;}}, 40);}

    >
    > Usually if something dealing with DIVs is working on everything except
    > Firefox, it can be because FF needs +"px" adding when assigning a
    > value that is in pixels. I don't know if it applies here. Try
    > rollo.scrollTop=(rollo.scrollTop+b)+"px" for example. Same for
    > scrollLeft.


    Doesn't apply.
    The "px" is required for CSS properties, but scrollTop and scrollLeft
    are not CSS and are plain number properties.

    Anyway: It works for me in Firefox (with the correct id, but it didn't
    work in Chrome with the wrong one either)

    > If it was enforced, then people would just create a dummy
    > gmail/yahoo/hotmail account and never bother looking at it, so
    > what's the point.


    Inconceivable!
    /L '*cough*'
    --
    Lasse Reichstein Holst Nielsen
    'Javascript frameworks is a disruptive technology'
    Lasse Reichstein Nielsen, Jun 10, 2009
    #9
  10. sara

    sara Guest

    "Lasse Reichstein Nielsen"
    wrote:
    ....................................................

    Lasse Reichstein Holst Nielsen
    > 'Javascript frameworks is a disruptive technology'
    >
    >

    Thank you Lasse
    I tryed adding "px" ((but I am not sure that is right to add it)) but there
    are not news and FF does'nt work. It go down but it does'nt go up.

    chrome works fine like opera and MSIE 8

    Now panorama is lower case

    This is new code working better with MSIE8, opera and chrome

    I chenged setinterval with settimeout to try but result is the some and FF
    does'nt work

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <HTML>

    <HEAD>

    <TITLE> New Document </TITLE>

    <script type="text/javascript">

    var rollo;

    var b=1;

    var c=1;

    function STT()

    {

    setTimeout(function(){rollo=document.getElementById('panorama');(rollo.scrollTop+=b)+"px";(rollo.scrollLeft+=c)+"px";if
    (rollo.scrollTop==450){b=parseInt(-1);}if
    (rollo.scrollTop==300){b=parseInt(1);}if
    (rollo.scrollTop==355){c=parseInt(-1);}if
    (rollo.scrollTop==450){c=parseInt(1);}STT();}, 40);}

    </script>

    </HEAD>

    <body onload="STT();">

    <div id="panorama" style="width:100%; height:150px; border:1px solid
    red;overflow:hidden">

    <img src="images/veylargelogo.jpg" />

    </div>

    </BODY>

    </HTML>
    sara, Jun 10, 2009
    #10
  11. sara

    Eric Bednarz Guest

    "Matthias Reuter" <> writes:

    > Stevo wrote:
    >
    >> Matthias Reuter wrote:
    >>> Sara wrote:
    >>>
    >>>> <div id="panorama">
    >>> ^^^^^^^^
    >>>
    >>>> setInterval(function(){
    >>>> rollo=document.getElementById('PANORAMA');
    >>> ^^^^^^^^
    >>> I'm surprised, this works in any browser.

    >>
    >> Why?

    >
    > Because ids are case sensitive.


    In XHTML, yes. In HTML, it depends. The normative prose says they are
    case sensitive, the normative syntax says they are subject to case
    folding (funny enough, if HTML were parsed by SGML rules, the above
    would be the only right way to go about it :).

    For sane practical usage your statement is correct though.
    Eric Bednarz, Jun 10, 2009
    #11
  12. sara

    Holger Suhr Guest

    sara schrieb:
    >
    > function STT()
    >
    > {
    >
    > setTimeout(function(){rollo=document.getElementById('panorama');(rollo.scrollTop+=b)+"px";(rollo.scrollLeft+=c)+"px";if


    this code has no effect...
    if scrollTop needs the 'px'
    rollo.scrollTop=(parseInt(rollo.scrollTop)+b)+'px';
    otherwise
    rollo.scrollTop+=b;

    > (rollo.scrollTop==450){b=parseInt(-1);}if
    > (rollo.scrollTop==300){b=parseInt(1);}if
    > (rollo.scrollTop==355){c=parseInt(-1);}if
    > (rollo.scrollTop==450){c=parseInt(1);}STT();}, 40);}
    >
    > </script>
    >
    > </HEAD>
    >
    > <body onload="STT();">
    >
    > <div id="panorama" style="width:100%; height:150px; border:1px solid
    > red;overflow:hidden">
    >
    > <img src="images/veylargelogo.jpg" />
    >
    > </div>
    >
    > </BODY>
    >
    > </HTML>
    >
    >


    I just wrote a panoramaviewer some days ago.
    I used
    -----------
    <div id='panorama' style='width:700px; height:150px; overflow=hidden'>
    <img id=thePic' src="images/veylargelogo.jpg">
    </div>
    -----------

    and in the code

    -----------
    var pic=document.getElementById('thePic');
    Xoff+=x;
    Yoff+=y;
    Fit(); // recalculate if picture moves out of the frame

    pic.style.marginLeft='-'+Xoff+'px';
    pic.style.marginTop='-'+Yoff+'px';
    -----------

    it works nice in FF 3.0.10, Opera 9.24, IE6, IE7

    With this Viewer, I can zoom in and out and drag the picture with
    mousemoves to the corners.

    If you'd like to see the code, I'll send you a mail.

    Holger
    Holger Suhr, Jun 10, 2009
    #12
  13. sara

    sara Guest

    "Holger Suhr"

    wrote:

    > If you'd like to see the code, I'll send you a mail.
    >
    > Holger
    >
    >
    >


    I thank you very much Holger (I wrote you) but please remember that my
    panorama is differente then others.

    My panorama don't show a panaroma from start-to-last- to-start but it is
    like a slow dance.

    It dance around an elipse

    It is for that that I like to do work my code with FF also
    sara, Jun 11, 2009
    #13
  14. sara

    Holger Suhr Guest

    sara schrieb:
    > "Holger Suhr"
    >
    > wrote:
    >
    >> If you'd like to see the code, I'll send you a mail.
    >>
    >> Holger
    >>
    >>
    >>

    >
    > I thank you very much Holger (I wrote you) but please remember that my
    > panorama is differente then others.
    >
    > My panorama don't show a panaroma from start-to-last- to-start but it is
    > like a slow dance.
    >
    > It dance around an elipse
    >
    > It is for that that I like to do work my code with FF also
    >
    >

    He he, I think my viewer it, too.
    Not an ellipse, but a sinewave.

    The code is in the cable per pm.

    Holger
    Holger Suhr, Jun 11, 2009
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hfk0
    Replies:
    2
    Views:
    21,644
  2. JavaQueries
    Replies:
    1
    Views:
    3,633
    John C. Bollinger
    Mar 1, 2005
  3. Balaji
    Replies:
    3
    Views:
    10,080
  4. Bishop
    Replies:
    1
    Views:
    765
    Bishop
    Feb 24, 2007
  5. juvi
    Replies:
    3
    Views:
    1,040
    Alexey Smirnov
    Jan 22, 2009
Loading...

Share This Page