Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] select
- From: andyg at ihug.co.nz (Andrew Gibson)
- Subject: [Javascript] select
- Date: Thu Mar 27 15:46:32 2003
The effect I want to achieve is, when selecting cat, an asterisk is placed
in the cell next to cat in the table. When dog is selected, the asterisk is
removed from cat row and an asterick is placed in the dog row. Kelly
===========================================================
Would this work?
<form>
<select onChange=test(this.form) size="1" name="pet" >
<option value="Select">Select</option>
<option value="Dog">Dog</option>
<option value="Cat">Cat</option>
</select>
</form>
<table>
<tr><td id=Dog>Dog</td></tr>
<tr><td id=Cat>Cat</td></tr>
</table>
<script>
var curPet="";
function test(frm)
{
if(curPet!=""){
document.getElementById(curPet).innerHTML=curPet;
}
var pet=frm.pet.options[frm.pet.selectedIndex].value
document.getElementById(pet).innerHTML="*"+pet
curPet=pet
}
</script>
Cheers
Andrew Gibson
- Follow-Ups:
- [Javascript] select
- From: David T. Lovering
- [Javascript] Flash Detection
- From: Marcelo Simon
- [Javascript] select
- References:
- [Javascript] select
- From: Michael Dougherty
- [Javascript] select
- From: Kelly Zhu
- [Javascript] select
- Prev by Date: [Javascript] required entry field
- Next by Date: [Javascript] select
- Previous by thread: [Javascript] select
- Next by thread: [Javascript] select
- Index(es):