outlined box example **** * * * * **** My code makes a outlined box that looks like **** * * * * * * ****
Thanks for any help!!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Print line with Multiple statements in JavaScipt</title>
<script type = "text/javascript">
var Strheight = window.prompt("Enter the height of box");
var Strwidth = window.prompt("Enter the width of box");
var Strfilled = window.prompt("If you want the box filled input 1, if you want an outline input 0");
var filled = parseInt(Strfilled);
var height = parseInt(Strheight);
var width = parseInt(Strwidth);
switch(filled){
//case if user picks filled box
case 1:
for(var j = height; j > 0; j--){
for(var i = 0; i < width; i++){
document.write("*");
}//end width for
document.write("<br />");
} //end height for
//Case to make unfilled box
case 0:
//for to write first line
for(var i = 0; i < width; i++){
document.write("*");
}
for(var j = height; j > 0; j--){
document.write("<br />");
document.write("*");
for(var k = (width - 2); k > 0; k--){
document.write(" ");//This is wear I'm having problem
}//end width for
document.write("*");
document.write("<br />");
}//end width for
//for to write last line
for(var i = 0; i < width; i++){
document.write("*");
}
}
</script>
</head>
<body>
</body>
</html>

New Topic/Question
Reply



MultiQuote




|