"FantaJ" <vi*********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi,
Is it possible to make a html button invisible using javascript?
I can certainly disable it:
var x=document.getElementById('button2');
x.disabled=true;
//x.type = 'hidden'; // read only?
//x.visible = false; // doesn't exist?
but is there a property i can (ab)use to make it invisible?
Thanks in advance.
<button id="myButton">My Button</button>
<button onclick="toggleVisibility('myButton');">Hide/show My
Button</button>
<button onclick="toggleDisplay('myButton');">Remove/restore My
Button</button>
<script type="text/javascript">
function toggleDisplay(id) {
var el;
if (document.getElementById) {
el = document.getElementById(id);
} else if (document.all) {
el = document.all[id];
}
if (el && (el = el.style) && ('string' == typeof el.display)) {
el.display = ('none' == el.display ? '' : 'none');
}
}
function toggleVisibility(id) {
var el;
if (document.getElementById) {
el = document.getElementById(id);
} else if (document.all) {
el = document.all[id];
}
if (el && (el = el.style) && ('string' == typeof el.visibility)) {
el.visibility = ('hidden' == el.visibility ? 'visible' :
'hidden');
}
}
</script>
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq