How to use parameter variable "id" from "BubbleGum.prototype.ToolBar = function(id)" through a function "checkmousepos(e,id)" body scope ?.
I've tried to use inline method onClick , traditional method element.onClick = dosomething(); and W3C Standard and microsoft method element.addEventListener with same problem happening which is variable id = undefined.
Can someone please for the love of universe vibrations provide me with a concise and simplistic answer not some tricky hack semi-trash.
BubbleGum.prototype.ToolBar = function(id) {
var TB = document.getElementById(id);
TB.style.position = "relative";
TB.style.marginLeft = (RootFrame.style.marginLeft);
TB.style.marginTop = "-22.0em";
TB.style.left = "0em";
TB.style.top = 0;
TB.style.height = "2em";
TB.style.width = (RootFrame.style.width);
TB.style.color = "black";
TB.style.backgroundColor = "#6a071a";
TB.style.borderTopLeftRadius = "0.4em";
TB.style.borderTopRightRadius = "0.4em";
TB.style.textAlign = "center";
TB.onclick = checkmousepos(id);
function checkmousepos(e, id) {
document.write(id);
//var TB = document.getElementById(id);
var mousex = e.pageX;
var mousey = e.pageY;
id.style.marginLeft = mousex + "px";
//TB.addEventListener("mousemove",dick,false);
//document.write("jello");
};
};