aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes check the syntax for show and hide Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "check the syntax for show and hide" Watch "check the syntax for show and hide" New topic
Author

check the syntax for show and hide

Jayasri Alaparthi
Ranch Hand

Joined: Aug 14, 2006
Posts: 67
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

Joined: Jan 10, 2002
Posts: 61662
    
  67

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 .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Aug 14, 2006
Posts: 67
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
 
 
subject: check the syntax for show and hide