Javascript - History, Adding to HTML, data types




CS174

Chris Pollett

Apr 4, 2016

Outline

Javascript

We now want to consider adding dynamic behaviors to our websites as they are interacted with on the client-side. To do this, we will use the Javascript language.

Uses of Javascript

Objects in Javascript

General Overview

Quiz

Which of the following statements is true?

  1. The command to make a complete copy of all the branches of a git repository is:
    git checkout url_of_repository
    
  2. Like svn, git commits are numbered sequentially starting at 1.
  3. To ask that an upstream repository on GitHub incorporate some changes that you've made, you can make a pull request.

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

Variables

Numeric Operators and Objects

Strings and Type Conversion