CECS 5100

Survey of Educational Computer Languages

Fall 2003

Need a free MP3 Player to listen to these clips ?


Audio Segments and Illustrations #2
  • Course Review (syllabus overview and comments)
  • Introduction
    Audio (476k 1:00)

  • Review of Previous Concepts
  • Overview of Operators
    Audio (2.7M 5:54)

  • Local and Global Variables (p. 277)
    Audio (1.9M 4:18)
      <html>
      <head>
      	<script language="JavaScript">
      		function showVar() {
      			alert(test)
      		}
      		
      		function loadVar() {
      			test = "6"
      		}
      
      		loadVar();  // loads variable test with "6"
      
      	</script>
      </head>
      
      <body>
      <form>
      <input type="button" value="click" onClick="showVar()">
      </form>
      
      </body>
      
      </html>
      

  • Debugging JavaScript (Ch 14, p. 409, 410, 412, 415)
    Audio (3.6M 7:52)

  • Order of Precedence (p. 201-202)
    Audio (896k 1:54)

  • Arrays (p. 245, 289)
    Audio (4.8M 10:38)

  • Forms (Ch 16, p. 311, 312, 461, 483)
    Audio (2.2M 4:56)
       Example 1 
      
      <html>
      <head>
      	<script language="JavaScript">
      		function readText(form) {
      			var TestVar = form.inputbox.value;
      			alert ("You typed: '" + TestVar + "'");
      		}
      		
      		function writeText(form) {
      			form.inputbox.value = "Have a nice day!";
      		}
      		
      	</script>
      </head>
      
      <body>
      
      <b>Example on page 462</b>
      <p>
      <form name="myform" action=" " Method="Get">
      	Enter something in the box:
      	<Input type="text" name="inputbox" value="">
      	<p>
      	<input type="button" name="button1" value="Read" onClick="readText(this.form)">
      	
      	<input type="button" name="button2" value="Write" onClick="writeText(this.form)">
      
      </form>
      
      </body>
      </html>
      
      
      Example 2 <HTML> </HEAD><TITLE>break</TITLE> <SCRIPT LANGUAGE = "JavaScript"> function validatePrompt() { var pInput = "" while (true) { pInput = prompt("Enter a number:", "") if (isNaN(parseFloat(pInput))) alert(pInput + " is not a number") else break } } </SCRIPT> <BODY> <H3>break</H3> Click on "Prompt..." and see what happens <FORM> <INPUT TYPE = "button" VALUE = "Prompt..." onClick = 'validatePrompt()'> </FORM> </BODY> </HTML>


    Copyright 2003, Dr. James G Jones