2
Hello, I’m new to programming and was trying to create a program. The application I use to run HTML5 reported an error on line 25 and 28. On line 25 I put onclick in a form of Submit and in between quotes put the name of a function. The error on line 28 was due to the.getElementById() document. I was wondering if someone 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>
						
would not be
document.getElementById("input").value?– Karl Zillner
If you withdraw
intbeforeaand ofb, playdocument.write(a);within the function and take the value withdocument.getElementById("input").value;will rotate– user60252
Thank you for the reply.
– nbbbvfd