question archive Rewrite the document for Exercise 5

Rewrite the document for Exercise 5

Subject:Computer SciencePrice:2.87 Bought7

Rewrite the document for Exercise 5.1 to assign the event handler to the event property of the button element. This requires the chosen color to be obtained from the value property of the button element rather than through the parameter.

5.1 Modify the radio_click.html example to have five buttons, labeled redbluegreenyellow, and orange. The event handlers for these buttons must produce messages stating the chosen favorite color. The event handler must be implemented as a function whose name must be assigned to the onclick attribute of the radio button elements. The chosen color must be sent to the event handler as a parameter.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Answer:

editable code:

<!DOCTYPE html>
<html>
<body>

<h3>Select which color you want to select</h3>

Red: <input type="radio" id="myRadio">
Blue: <input type="radio" id="myRadio">
Green: <input type="radio" id="myRadio">
Yellow: <input type="radio" id="myRadio">
Oramge:<input type="radio" id="myRadio">
<p>Select your favourite color</p>

<button onclick="myFunction()">Button</button>
<p id="demo"></p>


<script>
function myFunction() {
document.getElementById("demo").innerHTML = "This is my favourite color";
}
</script>

</body>
</html>

please use this google drive link to download the answer file.

https://drive.google.com/file/d/1vd-TlF7kKpoYxuAU_epejGz-6vLHD4sn/view?usp=sharing

note: if you have any trouble in viewing/downloading the answer from the given link, please use this below guide to understand the whole process.

https://helpinhomework.org/blog/how-to-obtain-answer-through-google-drive-link

Related Questions