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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

affecting value of one form element with the other

Status
Not open for further replies.

webslinga

Programmer
Jun 20, 2006
55
US
Hi all,
I have two buttons. One is called 'Staff' and the other 'Non-Staff'. I would like to make a text field value disappear when I click on the button labeled non-staff AND re-appear when button labeled staff is clicked.

I have no idea how to get this functionality working. If someone would be so kind to show me the way. Any feedback is appreciated.
 
basic functionality to do what you want:

Code:
document.forms['FormName'].elements['FieldName'].value = 'whatever value you want;';

so, here's one way:

Code:
<input type="button" value="Staff" onclick="this.form.elements['TheFieldToChange'].value = '';" />
<input type="button" value="Non-Staff" onclick="this.form.elements['TheFieldToChange'].value = 'something';" />



*cLFlaVA
----------------------------
[tt]somebody set up us the bomb![bomb][/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top