posted 16 years ago
Hi Friends,
Please some one check the syntax errors if any in declaration of toggleRows in ahref.
<script type="text/javascript">
function toggleRows(parentId,sourceID,oldContent,newContent)
{
var nodes = document.getElementById(parentid).parentNode.childNodes;
for( var i=0;i<nodes.length;i++)
{
if (nodes[i].id.length > 4 && nodes[i].id.substring(0,4) == parentid) {
if(nodes[i].style.display =='' || nodes[i].style.display =='none'){
nodes[i].style.display = (!nodes[i].style.display) ? 'none' : '';
changetext(sourceID,oldContent,newContent);
}
function changetext(changee,oldText,newText) {
//changes text in source element
var elementToChange = document.getElementById(changee);
elementToChange.innerHTML = (elementToChange.innerHTML == oldText) ? newText : oldText;
}
</script>
<body>
<div id="<%=prodTree.getKey()%>"><p>I am P1! I go away!</p>
Hello I am doing fine</div>
<a href="javascript:toggleRows(\""+prodTree.getKey()+"\",'changer','See All Subproducts','Hide All Subproducts');" id='changer'>See All Subproducts</a>
</body>