Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

BTEC IT Unit 20 - Website Design/JavaScript/Radio Buttons

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Choose input (Radio buttons) <body> <p>Choose your favourite colour!</p> <form> <input type="radio" name="colour" value="blue" onclick="myFunction()">Blue<br> <input type="radio" name="colour" value="red" onclick="myFunction()">Red<br> <input type="text" id="result" size="50"> </form> <script> function myFunction() { var colour = document.forms[0]; var txt = ""; var i; for (i = 0; i < colour.length; i++) { if (colour[i].checked) { txt = txt + colour[i].value + " "; } } document.getElementById("result").value = txt + "...such a nice colour"; } </script> </body> </html>