I am having troubles understanding the xhtml syntax for calling a function with an input button. I have searched for this, but cannot find a clear explanation.
This snippet of code is from my book, and it works ok, but I’m not sure exactly how the following line works:
From what I can figure out,
gradeForm is the form, and then
grade is the switch statement? So would you use
Foo if you had another switch statement called foo inside the
checkGrades function? And I am not sure what document or value are for inside the
onClick checkGrade function.
Any help would be very much appreciated!
grade refers to the textbox. You’re passing the value of the textbox into the
checkGrade function. The
switch statement is running over the
grade variable, which holds the value of the
You can’t really “name” a switch statement. The argument to the
switch represents the value you are testing.
document represents your HTML document, and
value is the value of the textbox named
grade. On another note, it is not recommended to use the
How old is this book you’re using?