Hello, I'm new to programming and trying to create a program. The application I use to run HTML5 reported an error on line 25 and line 28. On line 25 I placed onclick on a form of submit and entered the quotes I put the name of a function. The error on line 28 was because of the document.getElementById (). I wonder if anyone could help me?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Cups</title>
<style>
body {
background-color: orange;
}
p {
text-indent: 10%;
}
.a {
text-shadow: 0px 0px 5px black;
}
</style>
</head>
<body>
<p>Hi. This program give the number of needed cups to make a tower. The input is the number of cups in the base.</p>
<span class="a">Input:</span>
<label>Cups in base:</label>
<input id="input" type="text"/><br/>
<input id="input0" type="submit" onclick="program()"/>
<script>
function program() {
int a = document.getElementById("input");
int b = a;
while(b > 1) {
b = b - 1;
a = a + b;
}
}
document.write(a);
</script>
</body>
</html>