problem with running javascript on firefox

Discussion in 'Javascript' started by Paul Fi, Apr 8, 2006.

  1. Paul Fi

    Paul Fi Guest

    im trying to change the width of an object dynamically, this i s the
    object inside an html form

    input
    name="btnEmpty"
    id = "btnempty"
    type="button"
    class=""
    value=""

    and the emptybutton class :

    ..emptybutton
    {
    color:#FFFFFF;
    height:26px;
    width:20px;
    position:absolute;
    cursor: default;
    left: 1000px;
    top: 115px;
    }

    i have added an event handler that gets called when the body of the html
    is onload, the event handler is changewidth, this is the javascript code
    for the event handler

    function changewidth(){
    var emptybutton = document.getElementById("btnempty");
    style_emptybutton =
    document.defaultView.getComputedStyle(emptybutton,'');
    style_emptybutton.width =
    document.body.offsetWidth-parseInt(style_emptybutton.left);
    }

    that code doesnt work in firefox and throws an exception when the last
    instruction is ran:

    Error: uncaught exception: [Exception... "Modifications are not allowed
    for this document" code: "7" nsresult: "0x80530007
    (NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR)" location:
    "http://localhost/SmartOffice/Firefox/Home.js Line: 50"]

    anyone knows what im doing wrong here

    *** Sent via Developersdex http://www.developersdex.com ***
     
    Paul Fi, Apr 8, 2006
    #1
    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. James Wong
    Replies:
    2
    Views:
    574
    James Wong
    Feb 22, 2007
  2. Replies:
    0
    Views:
    692
  3. cjl
    Replies:
    4
    Views:
    142
  4. VK
    Replies:
    9
    Views:
    123
  5. Coder
    Replies:
    7
    Views:
    159
    The Magpie
    Jun 7, 2006
Loading...

Share This Page