J
jerryyang_la1
I've found this script that allows be to hide/show form elements..
<script language="JavaScript"><!--
var toggle = true;
function show(object) {
if (document.layers && document.layers[object])
document.layers[object].visibility = 'visible';
else if (document.all) {
document.all[object].style.visibility = 'visible';
document.all[object].style.zIndex = 100;
}
}
function hide(object) {
if (document.layers && document.layers[object])
document.layers[object].visibility = 'hidden';
else if (document.all)
document.all[object].style.visibility = 'hidden';
}
//--></script>
<form>
<input type="button" onClick="if (toggle = !toggle) hide('myId');else
show('myId')" value="Show/Hide">
</form>
<div id="myId" style="position: absolute; visibility:
visible;">Test</div>
This works well, but I have a couple questions...
1. Is there anyway to default this to HIDE ?
2. How would I change the button, to a checkbox or image ?
3. Any other script that will do that ?
Thanks
<script language="JavaScript"><!--
var toggle = true;
function show(object) {
if (document.layers && document.layers[object])
document.layers[object].visibility = 'visible';
else if (document.all) {
document.all[object].style.visibility = 'visible';
document.all[object].style.zIndex = 100;
}
}
function hide(object) {
if (document.layers && document.layers[object])
document.layers[object].visibility = 'hidden';
else if (document.all)
document.all[object].style.visibility = 'hidden';
}
//--></script>
<form>
<input type="button" onClick="if (toggle = !toggle) hide('myId');else
show('myId')" value="Show/Hide">
</form>
<div id="myId" style="position: absolute; visibility:
visible;">Test</div>
This works well, but I have a couple questions...
1. Is there anyway to default this to HIDE ?
2. How would I change the button, to a checkbox or image ?
3. Any other script that will do that ?
Thanks