This article mainly introduces JavaScript through this variable to quickly find the user to select the radio button, involving JavaScript in the use of this variable technique, very practical value, the need for friends can refer to the
The example in this article tells you how JavaScript uses this variable to quickly find out how the user selects the radio button. Share to everyone for your reference. The specific analysis is as follows:
The following JS code through the This variable combined with the radio button onchange event to quickly find the user selected which radio button
?
1 2 3 4 5 6 7 8 9 10 11 |
<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 |
I hope this article will help you with your JavaScript programming.