Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop and set multiple layers 1

Status
Not open for further replies.

ericaalicen

Programmer
Dec 20, 2001
53
US
I have a script that is used to hide and show layers that works fine. Now the client wants an option to expand all layers at once and I can't seem to get the syntax right.

Code:
<script type="text/javascript">
function expandAll(list)
{
var mycount = "#mycount#"	
    for (i=0; i < mycount; i++) 
    {
	document.getElementById("lyr"+i).style.display = "block"; 
	}
}
</script>

I'm passing in "lyr1", but don't really need to pass anything for this, really.

This is the call:
Code:
<a href="javascript:expandAll('lyr1');">

Any help is appreciated.
 
Have to ask yourself: a.The parameter "list" is not used, what is it destined for? b.The "#myaccount#" meaning what? Is it just figurative and is actually some number?
 
Thanks that helped. Here's the working code:

Code:
<script type="text/javascript">
function expandAll(lyrcount)
{
    for (i=1; i < lyrcount; i++) 
    {	
		var hideRow = "lyr" + i
		document.getElementById(hideRow).style.display = "block"; 
	}
}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top