Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

check the syntax for show and hide

 
Jayasri Alaparthi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what does:



actually look like when you view the source.

When you say you have an error, it would help if you actually said what the error message was.

Also you should look into http://www.getFirebug.com

Eric
 
Jayasri Alaparthi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

When I tried to click on Seeallsubproducts, it not even open the togglerows to debug.so I want to know if the declaration which I have given is correct.


with regards,
Bhargavi
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
View the source of the page and show us what the generated link looks like.

If you are running IE, what is the error message. CLick the error icon in the status bar to get the mesage. If you are running in Firefox, look at the JavaScript console for the error.

Without these details we can not help you out.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic