Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  permalink
    This script I'm working on produces an error in the JS Console for Firefox, which says "Error: Error in parsing value for property 'left'. Declaration dropped. Line: 0".

    Here is my code (actually I got it from Dynamic Drive but I heavily modified it):

    var slidemenu_width='160px' //specify width of menu (in pixels)
    var slidemenu_reveal='15px' //specify amount that menu should protrude initially
    var slidemenu_top='50px' //specify vertical offset of menu on page

    rightboundary=0
    leftboundary=(parseInt(slidemenu_width)-parseInt(slidemenu_reveal))*-1

    function pull(){
    if (window.drawit)
    clearInterval(drawit)
    pullit=setInterval("pullengine()",10)
    }

    function draw(){
    clearInterval(pullit)
    drawit=setInterval("drawengine()",10)
    }

    function pullengine(){
    themenu= document.getElementById("slidemenubar2").style
    if (parseInt(themenu.left)<rightboundary)
    themenu.left=parseInt(themenu.left)+10+"px"
    else if (window.pullit){
    themenu.left=0
    clearInterval(pullit)
    }
    }

    function drawengine(){
    themenu= document.getElementById("slidemenubar2").style
    if (parseInt(themenu.left)>leftboundary)
    themenu.left=parseInt(themenu.left)-10+"px"
    else if (window.drawit){
    themenu.left=leftboundary
    clearInterval(drawit)
    }
    }

    The script works perfectly fine, but I'm a perfectionist and thus I don't tolerate any errors of any kind in my scripts.

    Can anyone see what's producing this error and how I can fix it?
  2.  permalink
    Could you provide a test page where the bug can be reproduced? It's difficult to see what's going on without the rest of the html code.
    •  
      CommentAuthorJohnRiv
    • CommentTimeJun 26th 2006
     permalink
    As Kari pointed out, it's very tough to debug this without all the code so we can duplicate the error... however, if I had to guess, this is probably the line that's causing the error:

    themenu.left=leftboundary

    try changing it to

    themenu.left=leftboundary+"px"
    • CommentAuthorEbru
    • CommentTimeJul 6th 2006
     permalink
    I have got a similar problem too. I have a tabbed navigation page, that works good in IE, but in Firefox it fails badly.

    I have found the script from a script library and my scripting knowledge is not good enough to solve the problem :(

    Here is the url:

    http://www.paletinsaat.com/yeni/profilt.htm

    I would really appreciate if you can check it out and help me to solve this problem. Best wishes...
    •  
      CommentAuthorJohnRiv
    • CommentTimeJul 6th 2006
     permalink
    Ebru,

    Remember, if something works in IE but not Firefox, it's most likely coded incorrectly. Codefor Firefox first, then fix the IE bugs.

    After looking at your code, my suggestion is to first and foremost burn your copy of FrontPage. Then do some Google searching on "web standards" and "CSS" so you can lose your font tags and stop using tables for layout (it'll make your coding life a lot better). Once you've got a good grasp on that, then you can dive into scripting... and by scripting you'll want to search for "DOM Scripting", which is using JavaScript along with the DOM (document object model)... and stay far, far away from VBscript.
    • CommentAuthorEbru
    • CommentTimeJul 6th 2006
     permalink
    Thank you John for your rapid answer; I'll do my best to follow your precious advise. I hope I can handle it ^^
    • CommentAuthordanievh
    • CommentTimeMay 14th 2007
     permalink
    I got the same error while trying to dynamically update the top and left attributes of the style of a div tag.

    I resolved the issue by using (popupmenu is a div tag)

    popupmenu.style.top = y+50 +"px";
    popupmenu.style.left = x+20 +"px";

    instead of

    popupmenu.style.top = y+50;
    popupmenu.style.left = x+20;

    in firefox. IE seems to work either way.

    Hope this helps

    PS. I realize this is an old post but for the sake of the next persons sanity I just thought I'd add this.
Add your comments
    Username Password
  • Format comments as (Help)