Posted by Dima Gofman on 10/02/05 19:13
Here's a little demo. There are two easy methods of making buttons
disappear: using block and visibility styles. If you use block like
"SONY, JP" the browser will remove the button and redraw the page as if
the button was never there - be careful with this method because it
could break formatting of the rest of the page. Second method,
visibility, will hide the button but leave the space where it was
empty, keeping the formatting.
<script type='text/javascript'>
var flag=0;
function toggleButton(){
var obj=document.getElementById('cmd');
if (flag==0){
obj.style.visibility='hidden';
flag=1;
}
else{
flag=0;
obj.style.visibility='visible';
}
}
</script>
<input type='button' id='toggle' value='Click to toggle'
onclick='toggleButton()'>
<input type='button' id='cmd' value='I am a button'>
[Back to original message]
|