About 5 years ago, I uploaded this code for a floating layer on my website – works really really well, the only problem is – I forgot what the code means (I’m not a javascript expert)! The floating layer is positioned in the center of the screen and I now want to move it to the far left of the screen. How do I adjust the code to do that?? Sorry for the dumb question, but it’s been years… Can someone highlight the section of the code related to the screen position, and tell me how to adjust the position???
var useFloat = “”;
var nV = 0;
var tick = “”;
function hideMessage(){
clearTimeout(tick);
useFloat.style.display = ‘none’;
}
function stayHome(){
var xV = 0;
if(!document.body.scrollTop){xV = document.documentElement.scrollTop}
else {xV = document.body.scrollTop}
useFloat.style.top = nV+xV+”px”
tick = setTimeout(“stayHome()”,50);
}
function showMessage(nText){
useFloat.style.display = “”;
useFloat.innerHTML = nText;
stayHome();
}
function init(){
useFloat = document.getElementById(‘isFloat’);
nV = useFloat.offsetTop;
useFloat.style.display = ‘none’;
var msgWidth = parseInt(useFloat.style.width)
useFloat.style.left = ((screen.width-30)/2)-(msgWidth/2)+”px”;
}
window.onload=init;
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf(“?”))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_setTextOfLayer(objName,x,newText) { //v4.01
if ((obj=MM_findObj(objName))!=null) with (obj)
if (document.layers) {document.write(unescape(newText)); document.close();}
else innerHTML = unescape(newText);
}