Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Form Objects

Status
Not open for further replies.

steve100

Technical User
Aug 15, 2002
35
GB
Does anyone know how to create a javascript to switch off form objects?

I have two radio buttons in a form one with the value "did" the other "didnt".

When someone selects the "didnt" button I want an input select drop down box called "priority" to disappear from the form.

Does anyone know how this can be done?

Thanks
Steve
 
palce the inputs into a div and onClick set the visibility to hidden
example
<style>
.txt { visibility:visible; }
</style>
<script>
function hideIT() {
frm.input1.style.visibility = 'hidden';
}
</script>
</head>
<body>
<form name=&quot;frm&quot;>

<input type=&quot;text&quot; name=&quot;input1&quot; class=&quot;txt&quot; onBlur=&quot;hideIT();&quot;>
</form>
_______________________________________________
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }

_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
ok, so I give you a example and then write a different way. sorry my connectivity is all messed up and got kicked off half way through writing that one. forgot how I was writing it. both will work. the div would be better for larger amounts of inputs like a group of inputs. but as you see the direct call works as well _______________________________________________
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }

_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
You have an answer in the other copy of this thread. ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
what's wrong with my answer :p _______________________________________________
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }

_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top