Welcome to WebmasterWorld Guest from 3.229.122.166

Forum Moderators: open

Message Too Old, No Replies

Hiding Form elements until required.

make input forms visible/invisible

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

Junior Member

10+ Year Member

joined:Oct 1, 2002
posts:83
votes: 0


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

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

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members