Hey guys, I have to create a fairly simple ASP page for an assignment for my web management class and I seem to have run into a wall. I know the basics about ASP, and I am continuing to learn through W3Schools more advanced concepts. However, I can't seem to put together the knowledge that I have in order to complete this assignment as instructed.
Here is the task I have to complete:
Now, the part I'm having trouble with at the moment is how to store the values from the form textboxes in an array. We did a very similar project to this several weeks ago, but using JavaScript instead of ASP/VBScript. I know they are both similar, and perhaps someone can explain to me what differences there may be.Create a page that accepts the following information:
-10 different lab marks
-2 different project marks
-2 different test marks
-submit button
-reset button
Next, use VBScript to:
-when the submit button is clicked, store each value from the form into an array
-loop through the array
-add marks for labs
-add marks for projects
-add marks for tests
-output on the page: overall lab mark, project mark, and test mark
-use a nested if statement or select case statement to output the letter grade for the student's overall mark
So far, my main body code looks like this (the red code is unfinished, as it is the part I need help with):
I know the formatting isn't anything great, but I'm not concerned about that at this point (I want to get the code itself working properly before I deal with how it looks).Code:<% dim i for i=1 to 14 %> <form name="lab2" method="post" action="lab2.asp"> <input type="text" name="lab1mark" /> <input type="text" name="lab2mark" /> <input type="text" name="lab3mark" /> <input type="text" name="lab4mark" /> <input type="text" name="lab5mark" /> <input type="text" name="lab6mark" /> <input type="text" name="lab7mark" /> <input type="text" name="lab8mark" /> <input type="text" name="lab9mark" /> <input type="text" name="lab10mark" /> <input type="text" name="project1mark" /> <input type="text" name="project2mark" /> <input type="text" name="test1mark" /> <input type="text" name="test2mark" /> <input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /> <input type="text" name="outputlab" readonly="readonly" /> <input type="text" name="outputproject" readonly="readonly" /> <input type="text" name="outputtest" readonly="readonly" /> <input type="text" name="outputletter" readonly="readonly" /> </form>
Now, as I mentioned above, we did a similar thing to this in a previous project in which we needed to populate the options of a drop-down menu from a JavaScript array. I'm not sure if this will be of any help, but I hope it might be:
Can anyone help me out with this? I'd really appreciate it!Code:function addOption(selectbox,text,value ) { var optn = document.createElement("OPTION"); optn.text = text; optn.value = value; selectbox.options.add(optn); } function addOption_list(selectbox) { var comicBooks = new Array("Batman","Spiderman","Hulk","X-Men","Superman"); for (var i=0; i < comicBooks.length;++i) { addOption(document.myForm.comicList, comicBooks[i], comicBooks[i]); } }![]()



Reply With Quote
Bookmarks