VirtualMV/JavaScript/Forms/RadioButton

From WikiEducator
Jump to: navigation, search




Overview

VmvIcon Objectives.png

By the end of this page you will be able to:

  • Understand how a radio button is created

Radio button (js2_04)

<html><body>
<script type="text/javascript">
<!--
function fnCheck() {
if (document.frmChoose.radVal[0].checked) {
  alert("You chose the Add operation");}
if (document.myForm.radVal[1].checked) {
  alert("You chose the Subtract operation");}
}
//-->
</script>
<form name="frmChoose">
  <p>Select an operation:</p>
  <p><input type="radio" name="radVal" value="Add" />Add</p>
  <p><input type="radio" name="radVal" value="Subtract" />Subtract</p>
  <input type="button" value="Press Me" onClick="fnCheck()" />
</form>
</body></html>

Example :Click here to run js2_04.

VmvIcon References.png References

virtualMV  |  Superquick wiki guide  |  Please give me some feedback

VirtualMV/JavaScript/Forms/RadioButton. (2024). In WikiEducator/VirtualMV wiki. Retrieved November 5, 2024, from http:https://wikieducator.org/VirtualMV/JavaScript/Forms/RadioButton    (zotero)