Im doing something way out my league and Im messing up. I just started with JS. 2 main things I dont understand: 1) How do i get the Id's to run as arguments? 2) How do i get the return to go into the document.getElementById.innerHTML?
Thank you for your time.
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Golf</title>
<style>
</style>
</head>
<body>
Strokes: <input id="strokeset">
Par: <input id="parset">
<button onclick="golfScore('#strokeset','#parset')">klik</button>
<p id="demo">should be here</p>
</body>
<script>
function golfScore(par,strokes) {
if (strokes == 1) {
return "Hole-in-one!";
} else if (strokes <= par - 2) {
return "Eagle";
} else if (strokes <= par -1) {
return "Birdie";
} else if (strokes == par) {
return "Par";
} else if (strokes == par + 1) {
return "Bogey";
} else if (strokes == par + 2) {
return "Double Bogey";
} else {
return "Go Home!";
}
document.getElementById("demo").innerHTML;
}
</script>
</html>