Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

expand and collapse without using <div> tags, is it possible

Status
Not open for further replies.

ADisciple

Programmer
Jul 15, 2004
10
0
0
US
I finally got my code to work so that my tree can expand and collapse,

however,

when I started to piece all my code to the final page,

I'v noticed that my expand and collapse will not work with my left.include file

why? because it has div tags gradient style

is there a way I cannot use <div> in my javascript code..

I am totally new to this line of work, lovin it, though, here is the javacode example:

function Toggle(item) {
obj=document.getElementById(item);
visible=(obj.style.display!="none")
key=document.getElementById("x" + item);
if (visible) {
obj.style.display="none";
key.innerHTML="<img src='assets/images/folder.gif' width='16' height='16' hspace='0' vspace='0' border='0'>";
} else {
obj.style.display="block";
key.innerHTML="<img src='assets/images/textfolder.gif' width='16' height='16' hspace='0' vspace='0' border='0'>";
}
}

function Expand() {
divs=document.getElementsByTagName("div");
for (i=0;i<divs.length;i++) {
divs.style.display="block";
key=document.getElementById("x" + divs.id);
key.innerHTML="<img src='assets/images/textfolder.gif' width='16' height='16' hspace='0' vspace='0' border='0'>";
}
}

function Collapse() {
divs=document.getElementsByTagName("div");
for (i=0;i<divs.length;i++) {
divs.style.display="none";
key=document.getElementById("x" + divs.id);
key.innerHTML="<img src='assets/images/folder.gif' width='16' height='16' hspace='0' vspace='0' border='0'>";
}
}

Thanks a lot, and remember explain it to me like a 12 year old...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top