al cargarse mi página html quiero que parezca marcado un radio button de los tres que tiene in javascript

To select a particular radio button on page load using JavaScript, you can use the onload event handler to call a function that selects the button you want. Here's an example:

<!DOCTYPE html>
<html>
  <head>
    <title>Radio Button Selector</title>
  </head>
  <body onload="selectRadioButton()">
    <h1>Select a radio button</h1>
    <input type="radio" name="option" value="1">Option 1</input><br>
    <input type="radio" name="option" value="2">Option 2</input><br>
    <input type="radio" name="option" value="3">Option 3</input><br>

    <script>
      function selectRadioButton() {
        // Select the second radio button
        document.getElementsByName('option')[1].checked = true;
      }
    </script>
  </body>
</html>
560 chars
20 lines

In this example, the selectRadioButton() function is called on page load. It selects the second radio button by index and sets its checked property to "true", effectively selecting it. You can customize this function to select any radio button you want by changing the index value.

gistlibby LogSnag