
<!-- Odd -->
<html>
<head>
<title>Odd</title>
<style type="text/css">
body {
background-color:#000000;
color:#FFFFFF;
font-size:30;
text-align:center;
}
</style>
</head>
<body>
<script type="text/javascript">
var limit, count, stroutput;
count = 1;
stroutput = "";
document.write("<h1>Odd Numbers</h1>");
limit = prompt("Enter the limit", "");
if (limit == null)
{
stroutput = ("You clicked cancel. No count will be shown.");
}
else if (limit == "")
{
stroutput = ("Limit must be entered.");
}
else if (limit != parseInt(limit))
{
stroutput = ("Limit must be a valid whole number");
}
else
{
while (count <= limit) {
stroutput = stroutput + count + "\n";
count = count + 2;
}
}
alert (stroutput);
document.write("<br /><br />");
document.write("<br /><br />");
document.write("<input type='button' name='cmdReload'");
document.write(" value='Do again' onclick='window.location.reload()' />");
</script>
</body>
</html>
Many thanks this problem has been driving me crazy.


Sign In
Create Account


Back to top









