visable/invisable button

B

Bill Burke

Hello,

Is there a way to make an input button visable/invisable based on the value of a
variable? Or any other method? How?

TIA,
Bill Burke
(e-mail address removed)
 
N

Neredbojias

With neither quill nor qualm, Bill Burke quothed:
Hello,

Is there a way to make an input button visable/invisable based on the value of a
variable? Or any other method? How?

Javascript.
 
L

Leif K-Brooks

Bill said:
Is there a way to make an input button visable/invisable based on the
value of a variable? Or any other method? How?

HTML doesn't have variables.
 
T

Toby Inkster

SONY_JP said:
<input id="invis" type=button value="Camouflage"
onmouseout="this.form.invis.style.display='none'">

But useless if they use tab/spacebar to press the button.
 
D

Dima Gofman

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'>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top