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
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply 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: 56528
    
  14

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 .


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15362
    
    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: 15362
    
    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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: check the syntax for show and hide
 
Similar Threads
ToggleRows
web page printing
Probem in javascript in a JSF when implementing tiles in it
How to pass values from struts select tag to another struts tag?
hiding navigation bar