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
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