Forum Moderators: open

Message Too Old, No Replies

Hiding Form elements until required.

make input forms visible/invisible

         

walker

4:19 pm on Sep 10, 2003 (gmt 0)

10+ Year Member



Hi

Does anyone know how to make form elements(such as an input box text or file)visible/invisible at the click of a button.

Kind Regards

Rod

korkus2000

5:09 pm on Sep 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is a script that works in IE and other new browsers. It actually toggles the element hidden and visible when the function is called. It would be easy to modify:

<script>
function showHide(elementid){
if (document.getElementById(elementid).style.display == 'none'){
document.getElementById(elementid).style.display = '';
} else {
document.getElementById(elementid).style.display = 'none';
}
}
</script>

I don't know how cross browser it is. NN4 won't see it. Then you need to style the element with display:none. Then have what ever is calling it pass the id of the hidden element as an aurgument.