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

form select 1

Status
Not open for further replies.

vlitim

Programmer
Sep 2, 2000
393
0
0
GB
on a checkbox click I want to be able to set a select element which already has options in it to display the first option, is this possible?!!?
 
Do you mean something like this?


Code:
<form name=&quot;myForm&quot;>
<input type=&quot;checkbox&quot; onclick=&quot;selectWhenChecked(0)&quot;>Burger
<input type=&quot;checkbox&quot; onclick=&quot;selectWhenChecked(1)&quot;>Dog
<input type=&quot;checkbox&quot; onclick=&quot;selectWhenChecked(2)&quot;>Nachos

<select name=&quot;mySelect&quot;>
  <option>Fries
  <option>Kraut
  <option>Salsa
</select>

</form>
<script>
function selectWhenChecked(myNewChoice){

   document.myForm.mySelect.options[myNewChoice].selected = true;

}
</script>
 
Can I change the form action with an onlcick event? My form action is defaulted to &quot;file1.php&quot; but I want it to change to &quot;file2.php&quot; if a user hits a particular button. Is this possible??

I have been trying....

function change_action(mainform){
mainform.action.value = &quot;form2.submit();
}
Thanks in advance. {Greenster}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top