//Function to add a DIV on runtime and then move on MOUSE movementfunction addDiv(){//get the reference of Body tagdocument.getElementById("appcontent").removeEventListener("mousemove",enhancecursor,false);window.removeEventListener("mousemove",enhancecursor,true); var bodyTag=getBrowser().contentWindow.document.getElementsByTagName("body")[0]; //Remove the existing Highlight DIV if Present if(getBrowser().contentWindow.document.getElementById("divHighlited2")!=null){ var oNodeToRemove = getBrowser().contentWindow.document.getElementById("divHighlited2"); oNodeToRemove.parentNode.removeChild(oNodeToRemove); dump("Being removed \n"); } //Append the DIV in Body var ImgDIV=getBrowser().contentWindow.document.createElement("div"); ImgDIV.id="divHighlited2"; ImgDIV.setAttribute("style","position:absolute;top:2px;left:25px;height:20;width:20;z-index:99999"); bodyTag.appendChild(ImgDIV); //get the reference of newly Added DIV var divHighlited=getBrowser().contentWindow.document.getElementById("divHighlited2"); var imgElement=getBrowser().contentWindow.document.createElement("img"); imgElement.setAttribute("src","chrome://markit/skin/bm.png"); imgElement.setAttribute("border","0"); document.getElementById("appcontent").addEventListener("mousemove",enhancecursor, false); document.getElementById("appcontent").addEventListener("click",placeMark, false); divHighlited.appendChild(imgElement);}//MOve DIV under Cursorfunction enhancecursor(event) {//cursorplus.style.posLeft=event.clientX-10;getBrowser().contentWindow.document.getElementById("divHighlited2").style.left=parseInt(event.pageX-10);getBrowser().contentWindow.document.getElementById("divHighlited2").style.top=parseInt(event.pageY-10);}