...

View Full Version : How do I get cssFloat to work?



JB1
10-27-2009, 03:41 PM
How do I get cssFloat to work?

Here is the code I'm trying to get it working with:

Project.setGrants = function(index){

var n = 1;
var div1, div2, div3, div4;
var p = document.createElement('p');
var appendRequired = false;
var attribute = document.createAttribute('id');
attribute.value = 'sans-normal';
p.setAttributeNode(attribute);
p.style.width = "100%";

p.style.backgroundColor="lightblue"; //debugger

var grantSection = removeElement("Grants_Section");

//alert("projects[index].grantNames.length="+projects[index].grantNames.length);
if(projects[index].grantNames != null){
for(var i=0; i < projects[index].grantIDs.length; i++){
//alert("projects[index].grantIDs.length="+projects[index].grantIDs.length);
if (n % 2 == 1){
div1 = document.createElement('div');
div1.setAttribute("id", "divA"+i);
div1.style.clear="both";
div1.style.width = "100%";
div1.style.borderStyle="solid";
div1.style.borderColor="orange";

div2 = document.createElement('div');
div2.setAttribute("id", "divB"+i);
//div2.style.width = "140px";
div2.style.width = "20%";
div2.style.cssFloat = "left";
div2.style.backgroundColor="yellow";


div4 = document.createElement('div');
div4.setAttribute("id", "divD"+i);
//div4.style.width = "180px";
div4.style.width = "25%";
div4.style.cssFloat = "left";
div4.style.padding = "0px 10px 0px 10px";
div4.style.backgroundColor="red";

div2.appendChild(document.createTextNode(" "+projects[index].grantNames[i]));
//alert(div2.firstChild.nodeValue);
div1.appendChild(div2);
if(projects[index].grantValues[i] != null){
div4.appendChild(document.createTextNode(" "+projects[index].grantValues[i]));
//alert(div4.firstChild.nodeValue);
}
div1.appendChild(div2);
div1.appendChild(div4);
appendRequired = true;
}
else{
div3 = document.createElement('div');
div3.setAttribute("id", "divC"+i);
div3.style.width = "20%";
//div3.style.width = "180px";
div3.style.cssFloat = "left";
div3.style.paddingLeft = "40px";
div3.style.backgroundColor="limegreen";

div4 = document.createElement('div');
div4.setAttribute("id", "divD"+i);
//div4.style.width = "180px";
div4.style.width = "25%";
div4.style.cssFloat = "left";
div4.style.padding = "0px 10px 0px 10px";
div4.style.backgroundColor="red";

div3.appendChild(document.createTextNode(" "+projects[index].grantNames[i]));
//alert(div3.firstChild.nodeValue);

if(projects[index].grantValues[i] != null){
div4.appendChild(document.createTextNode(" "+projects[index].grantValues[i]));
//alert(div4.firstChild.nodeValue);
}
div1.appendChild(div3);
div1.appendChild(div4);
p.appendChild(div1);
appendRequired = false;
}
n = n +1;
}
if(appendRequired){
p.appendChild(div1);
}
}
grantSection.appendChild(p);
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum