ask the user to enter three of their favourite television shows. once they have entered there shows,display the results. Use an array to store the three favourite television shows.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Q217945</title>
</head>
<body>
<label for="i1">TV Show 1:<input id="i1" type="text"></label><br><br>
<label for="i2">TV Show 2:<input id="i2" type="text"></label><br><br>
<label for="i3">TV Show 3:<input id="i3" type="text"></label><br><br>
<input type="button" value="Submit" onclick="onClick()">
<script>
function onClick () {
document.body.innerHTML =
"<ul>" +
"<li>" + document.querySelector("#i1").value + "</li>" +
"<li>" + document.querySelector("#i2").value + "</li>" +
"<li>" + document.querySelector("#i3").value + "</li>" +
"</ul>"
}
</script>
</body>
</html>
Comments
Leave a comment