LESSON 2: JAVASCRIPT

LESSON 2




JavaScript and jQuery




JavaScript:


JavaScript is a powerful programming language that is very often used in web development. It was originally developed in 1995 by Brendan Eich while he was working for Netscape Communications. The first public release came in the form of the Netscape browser in version 2.0. Netscape Communication eventually became the Mozilla Foundation and the Netscape browser was changed into the very popular Firefox web browser. Brendan Eich also moved up in ranks at Mozilla and is currently now the CEO of Mozilla.

For JavaScript to work properly in yout HTML, you must signify that you are creating a JavaScript section. This is most often written in your <head> </head> section. Some people will put their JavaScript at the end of theit HTML to give time for therest of the page to lead before the JavaScript gets called. When you are coding in JavaScript you designate that a string will be avariable by using the "var" command.
Example of a simple JavaScript Section with variables:

<script>
var canwidth;
var c = document.getElementById("myCanvas");
var can1 = c.getContext("2d");
can1.moveTo(100,50);
can1.lineTo(100,200);
can1.lineTo(200,200);
can1.lineCap = 'square';
can1.lineWidth = 5;
can1.stroke();
</script>

Forms:


Forms in HTML allow the user to enter data into a webpage. this data is then passed along to the server and is usually stored in a database for future reference. Forms can contain many different HTML elements. Some of these elements include text fields, radio-buttons, check boxes, and submit buttons. To use a form properly you must use some type of input element. Form selectos in HTML are <form> and </form>



Data and Variables:


Data and Variable are used very extensively when programming. Data is a set of information. Data can include Integers, Boolean, and Variables. A variable is a symbol that can represent multiple values which are assigned to it. Variables are generally used as letters or strings.

Integers: can only be numbers
Boolean: are either one of two answers "True" or "False"
String: A Combination of letters and numbers. Often used as variables.


As you learn more about JavaScript and jQuery you will become more familiar with variables and how they work.

PREVIOUS: End Lesson 1
NEXT: jQuery