Microsoft
98-382 · Question #32
You are designing a web page that contains a blue button. When the button is pressed, it should call a function that displays the message 'Welcome!'. When the cursor hovers over the button, the…
The following event handlers should be added to the input element: HTML markup for the button: <input id="changer" type="button" value="Click Me" onmouseover="showRed()" onmouseout="showBlue()" onclick="notify()" style="background-color:blue; color:white;"/> Full script context…
Working with the Document Object Model (DOM)
Question
You are designing a web page that contains a blue button. When the button is pressed, it should call a function that displays the message 'Welcome!'. When the cursor hovers over the button, the button should turn red. When the cursor leaves the button, the button should revert back to its original color of blue.
You want to complete the markup using the appropriate HTML events.
How should you complete the markup? To answer, select the appropriate event in the answer area.
Explanation
The following event handlers should be added to the input element:
HTML markup for the button: <input id="changer" type="button" value="Click Me" onmouseover="showRed()" onmouseout="showBlue()" onclick="notify()" style="background-color:blue; color:white;"/>
Full script context for clarity (functions mentioned in the problem):
<script> function showRed() { var changer = document.getElementById("changer"); changer.style.backgroundColor = "red"; } function showBlue() { var changer = document.getElementById("changer"); changer.style.backgroundColor = "blue"; } function notify() { alert("Welcome!"); } </script>Topics
#HTML events#onclick#onmouseover#onmouseout
Community Discussion
No community discussion yet for this question.