INTRODUCTON
JavaScript
HTML JavaScript
Introduction
Web Applications and Real World Design - Knuckles
History
HTML Forms and JavaScript
HTML Forms and JavaScript
What is JavaScript
What is JavaScript
What is JavaScript
What is JavaScript
What is JavaScript
What is JavaScript
What is JavaScript
Identifier Etiquette
Variables
Assignment Operator
Expressions
Conditional Statements--if
if (some boolean expression is true){
execute the statements within
the curly braces, otherwise skip to the first statement after the closing brace
}
Resume execution here in either case
Conditional Statements– if/else
if (some boolean expression is true){
execute these statements, otherwise skip to ‘else’ clause
}
else {
execute these statements if boolean expression is false
}
Resume execution here in either case
Strings
JavaScript Functions – Basic Principles
JavaScript Functions – Basic Principles
JavaScript Functions – Basic Principles
JavaScript Functions – Syntax
function myFunctionName (list of parameters) {
….JS code here…
}
JavaScript Functions -- Issues
JavaScript Functions – Naming
findMaxValue(‘put some parameters here’)
JavaScript Functions -- Parameters
function findMaxValue(num1, num2, num3)
JavaScript Functions – Where to put?
<head>
<script language=“JavaScript”>
declare functions here….
</script>
</head>
JavaScript Functions – Local Variables
JavaScript Functions – Local Variables
function findMaxValue(num1, num2,num3) {
var tempMax; //local var
if (num1 >= num2) {
tempMax = num1;
}
else {
tempMax = num2;
}
if(num3 >= tempMax) {
tempMax = num3;
}
return tempMax;
} //end function
JavaScript Functions -- Calling
var x = 1, y = 4, z = 2;
findMaxValue(x, y, z);
JavaScript Functions -- Return
JavaScript Functions -- Return
var maxNumber = findMaxNumber(x, y, z);
document.write(“The maximum is: “ + maxNumber);
JavaScript Functions -- Return
JavaScript Functions -- Return
JavaScript Functions – Parameter Sequence
JavaScript Functions – Global Variables
var globalHello = “Hello!”;
function writeHello() {
document.write(globalHello);
}
// outputs “Hello!”
JavaScript Functions – Testing
JavaScript Functions – Debugging
JavaScript Functions
JavaScript and HTML Forms
JavaScript and HTML Forms
JavaScript and HTML Forms
JavaScript and HTML Forms
JavaScript and HTML Forms
Interactive Programming on the Internet Knuckles
JavaScript and HTML Forms
Interactive Programming on the Internet, Knuckles
JavaScript and HTML Forms
JavaScript and HTML Forms
JavaScript and HTML Forms
Interactive Programming on the Internet ,Knuckles
JavaScript and HTML Forms
JavaScript and HTML Forms
Interactive Programming on the Internet ,Knuckles
JavaScript and HTML Forms
Interactive Programming on the Internet ,Knuckles
JavaScript and HTML Forms
Form for submitting info for server side processing
Interactive Programming on the Internet ,Knuckles
JavaScript and HTML Forms