Dear Friends,

I not a java script expert I have found below script on the net and used it in to site.

This works fine on a static site. But when I integrated with PHP used it dynamically only the first row works. and other does not work. Actual Problem is in (function coll_all) & (fuction exp_all). How do it work with it.

regards


function exp_coll(ind)
{
s = document.getElementById("sp_" + ind);
i = document.getElementById("im_" + ind);
i2 = document.getElementById("im2_" + ind);
if (s.style.display == 'none')
{
s.style.display = 'block';
i.src = "images/minus.gif";
i2.src = "images/folder-open.gif";
}
else if (s.style.display == 'block')
{
s.style.display = 'none';
i.src = "images/plus.gif";
i2.src = "images/folder.gif";
}
}

function exp(ind)
{
s = document.getElementById("sp_" + ind);
i = document.getElementById("im_" + ind);
i2 = document.getElementById("im2_" + ind);
if (!(s && i && i2)) return false;
s.style.display = 'block';
i.src = "images/minus.gif";
i2.src = "images/folder-open.gif";
}

function coll(ind)
{
s = document.getElementById("sp_" + ind);
i = document.getElementById("im_" + ind);
i2 = document.getElementById("im2_" + ind);
if (!(s && i && i2)) return false;
s.style.display = 'none';
i.src = "images/plus.gif";
i2.src = "images/folder.gif";
}

function coll_all()
{

coll(0);
coll(10);
coll(15);
coll(22);
coll(37);
coll(48);
coll(119);
coll(126);
coll(139);
coll(141);
coll(150);
coll(151);
coll(158);
coll(160);
}

function exp_all()
{

exp(0);
exp(10);
exp(15);
exp(22);
exp(37);
exp(48);
exp(119);
exp(126);
exp(139);
exp(141);
exp(150);
exp(151);
exp(158);
exp(160);
}