The code you have is executed on the server with multiple scripts being added to the rendering output which is all streamed to the browser at once, it doesn't wait for you click the OK before proceeding.
To do it asynchronously as you ask it will need to be done on the client with JavaScript.
<script langauge='JavaScript'>
function ShowAlerts()
{
for(x = 0; x < 10, x++)
{
alert(x);
}
}
</script>