How to find the selected radio button immediately using the 'this' variable?

<script>
function favAnimal(button) {
alert('You like '+button.value+'s.');
}
</script>
<input type="radio" name="marsupial" value="kangaroo"
onchange="favAnimal(this)">Kangaroo

<input type="radio" name="marsupial" value="Opossum"
onchange="favAnimal(this)">Opossum

<input type="radio" name="marsupial" value="Tasmanian Tiger"
onchange="favAnimal(this)">Tasmanian Tiger


0 comments:

Post a Comment