Answer following questions on JAVA by clicking correct "Radio Button", then click "get score". Continue until score = 100%.
CIS 790 (Based on Plug n Play JavaScript) Prof. Auciello (790-quiz.htm) Overview: This JavaScript program uses onSubmit event handler to accept T/F responses to questions, and grades them. Radio Buttons are used to accept input. Clicking 'get score' calls the function "tester()". "forms" defines forms within an HTML page. It uses indices or a form name. Homework: Put these 3 questions in this quiz form: 1. Java is case-sensitive 2. HTML programs can have .txt as an extension. 3. Internet Explorer (MS) can be used instead of Netscape. Put a print out of the 3 questions in your project notebook. (Use Print Screen to capture screen, paste to Word.) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Review: Note the beginning / ending of the comment delimeters. Action Item: Circle beginning and ending delimiters. Background / Foreground Colors: Select combination that you think enhances the quiz. Lesson: Re: Look at the Screen: (starting from top) Find the Title Area. Action: Change to your name. Re: Location contains File:///c|dirjava/quiz.htm This is a Unix-based, fully qualified, path name. Action: Put in the blank, what you think the DOS equivalent of this name: ____________________ How many applications are open on the Desktop? ___ What is the advantage of having the source file open (Quiz - Wordpad) and Netscape running? ---------------------------------------------------- ---------------------------------------------------- Because this page is in HTML and uses HTML examples, the HTML talked about will use [HTML] not the the required "less and greater than" symbols. HTML: Style of HTML: Almost all HTML statements begin and end in the form of [HTML] .... [/HTML]. Action Item: Draw lines, in left margin, connecting the matched statements. What is the difference between H1, H2, H3? (discover by experiment and/or look it up). Action: Insert your name at top of quiz. [pre] means "pre-formatted" or ASCII format = includes line feeds, multiple spaces, and mono- spaced fonts. Explain [Script] ... Action: Remove the [pre] tags, and note difference. Action: Define [HEAD], [BODY], [CENTER] Define FORM, method, Define onSubmit (event handler), INPUT JavaScript: What is a 'function'? What does a function do? How is it invoked ("called")? Name of function? Why does tester have "()"? (Note all Java Script statements are enclosed in brackets.) What is "var"? Does the "var" statement define a variable? (test this, by eliminating a variable from it.) What does "var a = ... = e = 0" do? (small example of efficiency of Java) Action: understanding counting from base of 0. What does "==" do? "document" is an object with properties, such as "elements" (like rows in array) Note indented, 'structured' style used. --------------------------------------------------------- Source Program in HTML and JAVA follows Can only be viewed by Edit - View Source Code --------------------------------------------------------- [!-- [HTML] [HEAD] [TITLE]790-QUIZ GREG McKINNEY [/TITLE] [SCRIPT]function tester() { var a = b = c = d = e = f = g = 0 if(document.forms[0].elements[0].checked==true) { a = 1 } if(document.forms[0].elements[2].checked==true) { b = 1 } if(document.forms[0].elements[5].checked==true) { c = 1 } if(document.forms[0].elements[6].checked==true) { d = 1 } if(document.forms[0].elements[9].checked==true) { e = 1 } if(document.forms[0].elements[10].checked==true) { f = 1 } if(document.forms[0].elements[12].checked==true) { g = 1 } total = a + b + c + d + e + g alert ("breakpoint: ", a+b+c+d+e+g); if(total == 6) { alert("6 out of 6 correct, Great Job!") } if(total [ 6) { alert("You got " + total + " of 6 correct, try again!") } } [/SCRIPT] [/HEAD] [BODY BGCOLOR=yellow text=blue] [CENTER] [H1]CIS 790 Sample Quiz - Your Name (H1)[/H1] [H3]LA TRADE TECH -- JAVA -- PROF. AUCIELLO (H3)[/H3] [/CENTER] [pre] Answer following questions on JAVA by clicking correct "Radio Button", then click "get score". Continue until score = 100%. [/pre] [FORM method=post onSubmit=tester()] 1. JavaScript can be embedded into HTML, and run by a Browser? [br] [INPUT type=radio name=a]True [INPUT type=radio name=a]False [br] 2. JavaScript allows breakaway, unlike static HTML.[br] [INPUT type=radio name=b]True [INPUT type=radio name=b]False [BR] 3. JavaScript can not be included directly into the HTML.[br] [INPUT type=radio name=c]True [INPUT type=radio name=c]False [BR] 4. JavaScript allows the user to program in HTML? [br] [INPUT type=radio name=d]True [INPUT type=radio name=d]False [BR] 5. Java can run on a Windows 3.1 (16 bit) system? [br] [INPUT type=radio name=e]True [INPUT type=radio name=e]False [BR] 6. As I do this, I am getting the 'feel' to create an On-Line Order Questionaire. [br] [INPUT TYPE=TEXT name=g value ' '] [INPUT TYPE=TEXT name=g value ' '] [br] 7. I can put this quiz on to my Home Page. [br] [INPUT type="radio" name=f]True [INPUT type=radio name=f]False [BR] [CENTER] [Input type=submit value="get score"] [Input type="reset" value="clear"] [/CENTER] --] [/FORM] [/BODY] [/HTML]