Javascript




CS174

Chris Pollett

Oct. 7, 2013

Outline

Javascript

Uses of Javascript

Objects in Javascript

General Overview

Lexicon

Example Javascript and HTML document

<html>
<head><title>test</title>
<meta name="description" value="this example illustrates how Javascripts are executed both when the document is loaded and on the occurrence of events" />
<script type="text/javascript" >
   function sayHello()
   {
		alert("hi there");
   } 
</script>
</head><body><form><input type="button" value="test" onClick="return sayHello();" 
/><!-- responds to events --></form>
<script type="text/javascript" >
for( i = 0; i<100; i++)
{ 
	document.writeln("<p>hi"+i+"</p>");
} // run when document loads
</script></body>
</html>

Primitives

Quiz

Which of the following statements is true?

  1. In PHP a class can use many traits.
  2. PHP doesn't support sub-namespaces.
  3. Subversion is the most popular distributed version control system.

Variables

Numeric Operators and Objects

Strings and Type Conversion