G
grandeandy
question: in the code below, and in general, how would I input multiple
functions into the code, and get multiple outputs? basically, I want to
be able to add say 2 or 3 of the div's to the link so that it shows
multiple div's at once.
<script language="javascript">
<!--
var state = 'none';
function hide(layer_ref) {
if (state == 'block') {
state = 'none';
}
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;
}
}
function show(layer_ref) {
if (state == 'none') {
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>
<p><a href="#" onclick="hide('div1');">hide me</a></p>
<p><a href="#" onclick="show('div1');">show me</a></p>
<div id="div1" style="display: none;">This is the content 1</div>
<div id="div2" style="display: none;">This is the content 2</div>
<div id="div3" style="display: none;">This is the content 3</div>
functions into the code, and get multiple outputs? basically, I want to
be able to add say 2 or 3 of the div's to the link so that it shows
multiple div's at once.
<script language="javascript">
<!--
var state = 'none';
function hide(layer_ref) {
if (state == 'block') {
state = 'none';
}
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;
}
}
function show(layer_ref) {
if (state == 'none') {
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>
<p><a href="#" onclick="hide('div1');">hide me</a></p>
<p><a href="#" onclick="show('div1');">show me</a></p>
<div id="div1" style="display: none;">This is the content 1</div>
<div id="div2" style="display: none;">This is the content 2</div>
<div id="div3" style="display: none;">This is the content 3</div>