P
pamelafluente
Thank you Benjamin!! You are a star!
Beautiful code.
-Pam
PS
I am studying javascript. I like it, but I am used to tools like
debuggers and intellisense (I work with VS2005/ASP.NET). Is there
something similar for javascript? My greatest problem is to remember
all the objects members names and to type correctly the statements.
Also, the issues about cross compatibility make things more
complicated.
I noticed many people use underscore "_" to start variable names. Is
that a style or some kind of compatibility trick?
Benjamin ha scritto:
Beautiful code.
-Pam
PS
I am studying javascript. I like it, but I am used to tools like
debuggers and intellisense (I work with VS2005/ASP.NET). Is there
something similar for javascript? My greatest problem is to remember
all the objects members names and to type correctly the statements.
Also, the issues about cross compatibility make things more
complicated.
I noticed many people use underscore "_" to start variable names. Is
that a style or some kind of compatibility trick?
Benjamin ha scritto:
function afunc() {
var search = document.body.getElementsByTagName("*");
if (search.length <= 1) {
return;
}
var i = 0;
var bottomPos = 0;
var bottomElem = 0;
var offsetY = 0;
offsetObj;
for (i = 0; i < search.length; i++) {
if (search.id = "myFooter") {
continue;
}
offsetObj = search;
while (offsetObj) {
offsetY += (offsetObj.offsetTop +
offsetObj.offsetHeight);
offsetObj = offsetObj.offsetParent
}
bottomPos = (offsetX > bottomPos) ? offsetX : bottomPos;
}
var myFooter = document.getElementById("myFooter");
myFooter.style.position = "absolute";
var your Padding = 50;
myFooter.style.top = bottomPos + yourPadding + "px";
}
trigger this function like this: <body onload="afunc()">
correct
Benjamin,
I will say in word:
If page contains nothing or only the footer DIV
there is nothing to do. Exit the void function.
define 3 variables. The first variable is for iteration
in the collection of page elements. The second
to store the bottom position. And the third
to store the element which featured such
position.
Iterate on all the elements different fron the footer DIV
to find out which is has lowest position
Once you find it assign the footer position as the position
of the lowest element plus some vertical offset
//
Thanks
-P