JavaScript - invalid argument IE8

Viewed 11883

I've got a little JavaScript problem. The code is working in Opera and Firefox browser but not in Internet Explorer 8. Does anybody know why?

function createbtn(object, inner) {
    var hover = document.createElement("div");
    hover.setAttribute("class", "myarea");
    if (inner) {
        hover.style.width = object.width - 16 + "px";
        hover.style.height = object.height - 16 + "px";
        hover.style.top = getposy(object) + "px";
        hover.style.left = getposx(object) + "px";
    } else {
        hover.style.width = object.width + "px";
        hover.style.height = object.height + "px";
        hover.style.top = getposy(object) - 8 + "px";
        hover.style.left = getposx(object) - 8 + "px";
    }
}

I'm just learning Javascript. Any feedback welcome. Simon

2 Answers
Related