newtda
10-12-2003, 07:33 PM
Hello people I am new to the board and I am new to java script. I am actually taking a class in java script and need alot of help. here is what we have to come up with.
1) Prompts for how many bars. For example, lets say 3.
2) Then prompts you 3 times.
a) you enter a 1
b) you enter a 4
c) you enter a 3
3) It will display 3 rows (from 1)
Each row will contain the number of images, like
a) row 1, will show 1 image
b) row 2, will show 4 images
c) row 3, will show 3 images
-Make sure it displays all of them after you do all the prompts.
-You can replace ALL the number with any number.
Here is what I came up with:
<html>
<head>
<script>
var the_image = new array();
var bars = prompt("how many images do you want?","");
for (var loop=0; loop < image; loop++)
{
var value = prompt("how long is this chart? (1-5)","");
the_image[loop] = value;
}
for (var loop=0; loop < image; loop++)
{
drawbars(the_image[loop])
}
{
function drawbars(the_numbber)
for (var loop=0; loop < the_image; loop++)
{
window.document.writte("<img src=ampsub.jpg>");
}
</script>
</head>
<body>
</body>
1) Prompts for how many bars. For example, lets say 3.
2) Then prompts you 3 times.
a) you enter a 1
b) you enter a 4
c) you enter a 3
3) It will display 3 rows (from 1)
Each row will contain the number of images, like
a) row 1, will show 1 image
b) row 2, will show 4 images
c) row 3, will show 3 images
-Make sure it displays all of them after you do all the prompts.
-You can replace ALL the number with any number.
Here is what I came up with:
<html>
<head>
<script>
var the_image = new array();
var bars = prompt("how many images do you want?","");
for (var loop=0; loop < image; loop++)
{
var value = prompt("how long is this chart? (1-5)","");
the_image[loop] = value;
}
for (var loop=0; loop < image; loop++)
{
drawbars(the_image[loop])
}
{
function drawbars(the_numbber)
for (var loop=0; loop < the_image; loop++)
{
window.document.writte("<img src=ampsub.jpg>");
}
</script>
</head>
<body>
</body>