VirtualMV/JavaScript/Forms/CheckBox
From WikiEducator
< VirtualMV | JavaScript
Overview
By the end of this page you will be able to:
|
Check box (js2_05)
<html><body> <script type="text/javascript"> <!-- function fnCheck() { var strX = ""; objDrink=document.frmChoose.chkDrinks; if (objDrink[0].checked) {strX = strX + objDrink[0].value +" ";}; if (objDrink[1].checked) {strX = strX + objDrink[1].value +" ";}; if (objDrink[2].checked) {strX = strX + objDrink[2].value + " ";}; alert("You have selected: " +strX); } //--> </script> <form name="frmChoose"> <input type="checkbox" name="chkDrinks" value="milk" />Milk<br /> <input type="checkbox" name="chkDrinks" value="cream" />Cream<br /> <input type="checkbox" name="chkDrinks" value="sugar" />Sugar<br /> <input type="button" value="Order" onClick="fnCheck()" /> </form> </body></html>
Example :Click here to run js2_05.
References
virtualMV | Superquick wiki guide | Please give me some feedback |
VirtualMV/JavaScript/Forms/CheckBox. (2024). In WikiEducator/VirtualMV wiki. Retrieved December 22, 2024, from http:https://wikieducator.org/VirtualMV/JavaScript/Forms/CheckBox (zotero)
|