user input determines count of displays
<p>I have been trying for days to get this to work. I have the basic code but every time I try to get the last requirement added, I break the code. I'm sure I am missing a lot and that's why I can't add the alert box with the count of displays. So it asks the users name, the number of times they want to see and alert box and if they enter invalid answers they see alert boxes telling them to enter a correct value. The last part that I am stuck on is the value the user enters determines how many alert boxes show their name and the box needs to say which box it is. So, <code>&lt;Name&gt;</code> this is time number <code>&lt;count of displays&gt;</code> of <code>&lt;total time to display&gt;</code>. I was trying different things with limiting and FOR , with the user Y variable being the limiter. Any clues or help would be greatly appreciated.</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;

&lt;p&gt;Please enter your name followed by how many times you would like to be alerted.&lt;/p&gt;

&lt;button onclick="myFunction()"&gt;Start&lt;/button&gt;



&lt;script&gt;


function myFunction() {
    var x;

    var name = prompt("Please enter your name", "");
    if (name == null || name == "") {
        alert("Please input a name.");

        return false;
    }
    else {
        var y;
        var y = prompt("Please enter a number between 1-10");
        if (y == null || y == "") {
            alert("Please input a number for the times to alert the name.");
            return false;
        }
        if (y &gt; 10) {
            alert("Please input a number between 1 and 10.")
            var y = prompt("Please enter a number between 1-10");

        }
        if (y &lt;= 0) {
            alert("Please input a number great than zero.")
            var y = prompt("Please enter a number between 1-10");

        }
    }
}

&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
