Help About JavaScript

Status
Not open for further replies.

macypro

Active Member
63
2009
0
0
Hello all,

I need help about java script. For example: i have some text and users must click "see hidden" to show that.
I need script called by div, becouse that will only work im my case :)
 
1 comment
TRy this:

<script language="javascript">
<!--

var state = 'none';

function showhide(layer_ref) {

if (state == 'block') {
state = 'none';
}
else {
state = 'block';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}
}
//-->
</script>

and this html code for each division that is to be hidden/shown:
<p><a href="#" onclick="showhide('div1');">Show/hide me</a></p>
<div id="div1" style="display: none;">This is the content</div>
 
Status
Not open for further replies.
Back
Top