Presentation is loading. Please wait.

Presentation is loading. Please wait.

Donna J. Kain, Clarkson University

Similar presentations


Presentation on theme: "Donna J. Kain, Clarkson University"— Presentation transcript:

1 Donna J. Kain, Clarkson University
JavaScript Basics Donna J. Kain, Clarkson University

2 What it is JavaScript is
A tool you can use to make HTML pages more dynamic. A scripting language with similarities to programming languages but not programming. A client side component. Object based Donna Kain Clarkson University

3 What it isn’t A programming language
Though it has similarities to Java and C++ Donna Kain Clarkson University

4 What it can do Instruct browser to display information (I.e. user’s browser type) Make webpage appearance different depending on browser Monitor user events and specify reactions (I.e. mouse overs) Generate html for parts of pages Modify a page in response to events (I.e. click to change page color) Donna Kain Clarkson University

5 What it can do Check user input (I.e. in a form)
Replace and update parts of pages (I.e. current date and time; user history of browsing) Change style and position of page elements dynamically (I.e. create moving layers that follow the user’s mouse) Control windows Create alerts and messages Donna Kain Clarkson University

6 How it works JavaScript runs in the browser is added to HTML pages
Within the head element of a page Within the body element of a page Donna Kain Clarkson University

7 Conventions Script tags JavaScript is case sensitive
<script language=“JavaScript”> Script goes here </script> <!-- //--> (comment tags hide script from old browsers) JavaScript is case sensitive Donna Kain Clarkson University

8 Conventions Functions and Arguments Document.write is a function
<script language=“JavaScript”> <!-- document.write(“Here’s a script”) ; //--> </script> Document.write is a function Document is a pre-defined object Write is a pre-defined method The dot connects the object and the method Donna Kain Clarkson University

9 Conventions You can create names for objects, functions, and variables in JavaScript. However, note that reserved words that have special junctions in JavaScript. <script language=“JavaScript”> <!-- document.write(“Here’s a script”) ; //--> </script> Info in parentheses is an argument. The argument here is a string, which must be in quotation marks. Place a semi-colon after JavaScript statements Donna Kain Clarkson University

10 Do it/View it Create a simple HTML page with the basic HTML, head, title, and body elements. Place the JavaScript in the body of the page. <script language=“JavaScript”> <!-- document.write(“Here’s a script”) ; //your script// //--> </script> Donna Kain Clarkson University


Download ppt "Donna J. Kain, Clarkson University"

Similar presentations


Ads by Google