problem with running javascript on firefox

P

Paul Fi

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top