Display/hide button

M

magix

Hi,

I want to display or hide the button.

Condition is
1. During Onload, "Update" button is Hide.
2. the drop down list must be selected, meaning SelectedIndex != 0
3. all 5 input text edit box must have value in it.

After the condition 2 and 3 are fulfilled, the Update Button will appear.

How to achieve that in javascript ? please help.
 
E

Evertjan.

magix wrote on 14 mrt 2007 in comp.lang.javascript:
Hi,

I want to display or hide the button.

Condition is
1. During Onload, "Update" button is Hide.
2. the drop down list must be selected, meaning SelectedIndex != 0
3. all 5 input text edit box must have value in it.

After the condition 2 and 3 are fulfilled, the Update Button will appear.

How to achieve that in javascript ? please help.

<button style='display:none;' id='b'> ....

if (allIsWell)
document.getElementById('b').style.display = 'block';
 
T

Tom Cole

magix wrote on 14 mrt 2007 in comp.lang.javascript:






<button style='display:none;' id='b'> ....

if (allIsWell)
document.getElementById('b').style.display = 'block';

Where function allIsWell might look something like:

function allIsWell() {
return (document.getElementById('mySelect').selectedIndex >= 0 &&
document.getElementById('myText1').value &&
document.getElementById('myText2').value &&
document.getElementById('myText3').value &&
document.getElementById('myText4').value &&
document.getElementById('myText5').value);
}

Replace with your actual element id's of course...
 

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

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top