JavaScript: Sliding menus adaptation: Setting default state?

Status
Not open for further replies.

indigo

Well-known member
5,606
Ok, here's a bit of code:

code:<HR>
Code:
function toggleElement(currElement) {
	if (document.getElementById) {
		thisElement = document.getElementById(currElement).style
		if (thisElement.display == "block") {
			thisElement.display = "none"
		}
		else {
			thisElement.display = "block"
		}
				
		return false
	}
	else {
		return true
	}
}

Basically ripped from a JScript book...

Here's the button:

code:<HR>
Code:
<input type=button name=blah value="Advanced Search" OnClick="JavaScript:return toggleElement['AdvancedSearch')">

Here's the stuffs:

code:<HR>
Code:
<td>
<div id='AdvancedSearch'>
Testing...1,2,3
</div>
</td>

So... when the screen comes up, by default, it shows the text. That's bad. How do I set the default state to hide the text?

What's more, it seems I can't put the div or span tags outside of the cell... it'd be nice if I could figure out how to make the entire cell appear/disappear at the click of the button...

TIA
 
Status
Not open for further replies.