JavaScript General - How to find the selected radio button immediately using the this variable?
Interview Question Database For Software Developers
|
|
| How to find the selected radio button immediately using the this variable? | | How to find the selected radio button immediately using the 'this' variable? | | By: |
<script>
function favAnimal(button) {
alert('You like '+button.value+'s.');
}
</script>
<input type="radio" name="marsupial" value="kangaroo"
onchange="favAnimal(this)">Kangaroo
<br /><input type="radio" name="marsupial" value="Opossum"
onchange="favAnimal(this)">Opossum
<br /><input type="radio" name="marsupial" value="Tasmanian Tiger"
onchange="favAnimal(this)">Tasmanian Tiger
| | ID: 2169 | Rank: 584 | Votes: 0 | Views: 134 | Submitted: 20081209 |
Copyright © 2009 FYIcenter.com
All rights in the contents of this Website are reserved by the individual author.
No part of the contents may be reproduced in any form without author's permission.
|
|
|