HTML & teh internets.

Slides:



Advertisements
Similar presentations
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Advertisements

Java Script Session1 INTRODUCTION.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
HTML Forms JavaScript Introduction / Overview Lab Homework #1 CS 183 4/8/2010.
1 Javascrbipt Intro Javascript (or js) is a programming language. Interpreted, not compiled. Not the same as java, but, similar. Use tags to use. Object-oriented.
JavaScript- Introduction. What it is and what it does? What it is? It is NOT Java It is NOT Server-side programming Users can see code It is a client-side.
Javascript Client-side scripting. Up to now  We've seen a little about how to control  content with HTML  presentation with CSS  Javascript is a language.
Javascript and the Web Whys and Hows of Javascript.
Forms and Java script. Forms The graphical user interface -textbox, radio, button, textarea, checkbox… The processing script –CGI scripts, Perl script,
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Scripting Languages.
Javascript and Basic Programming Concepts. What is a Program? A program is a specific set of instructions written in a computer language to perform a.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
Internet Mark-up Languages CO32036 Part Lecture: Elementary JavaScript.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
1 rfXcel Confidential Copyright 2007 Web Technology JavaScript 12/10/07.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
1 JavaScript 1. 2 Java vs. JavaScript Java –Is a high level programming language –Is platform independent –Runs on a standardized virtual machine.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
1 JavaScript
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
Web Development 101 Presented by John Valance
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Introduction To JavaScript. Putting it Together (page 11) All javascript must go in-between the script tags. All javascript must go in-between the script.
Enhancing Websites with JavaScript. How Do You Give Directions? Lots of details? Specific steps? Just the gist? What language?
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Creating Web Documents: JavaScript Ftp / file management: review Introduction to JavaScript Sources Homework: start review for midterm, work on Project.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
This is our seminar JavaScript And DOM This is our seminar JavaScript And DOM.
Chapter 5: Intro to Scripting CIS 275—Web Application Development for Business I.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JavaScript Tutorial First lecture 19/2/2016. Javascript is a dynamic computer programming language. It is lightweight and most commonly used as a part.
1 HTML & teh internets. 2 Contents JavaScript CSS Goal: Integrating knowledge.
CGS 3066: Web Programming and Design Spring 2017
Build in Objects In JavaScript, almost "everything" is an object.
Java Script Introduction. Java Script Introduction.
Web Systems & Technologies
JavaScript is a programming language designed for Web pages.
Donna J. Kain, Clarkson University
Barb Ericson Georgia Institute of Technology May 2006
JavaScript.
14 A Brief Look at JavaScript and jQuery.
BY: SITI NURBAYA ISMAIL FACULTY of COMPUTER and MATHEMATICAL SCIENCES
DHTML.
DHTML Javascript Internet Technology.
More Selections BIS1523 – Lecture 9.
Introduction to JavaScript for Python Programmers
DHTML Javascript Internet Technology.
The Web Wizard’s Guide To JavaScript
JavaScript Defined General Syntax Body vs. Head Variables Math & Logic
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
Introduction to Programming and JavaScript
Introduction to JavaScript
Web Programming and Design
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

HTML & teh internets

Contents JavaScript ... Javascript And JavaScript! Goal: Understand the basics

HTML, CSS, JavaScript HTML Similarities Layout: CSS Scripting: JavaScript Similarities Both are plain text Both can be used internally (embedded) or externally (linked) Both take over stuff that can also happen within HTML

JavaScript JavaScript allows you to manipulate an html page AFTER it has been sent to the client. This means you don’t have to click a link to do something. Think of: Images that change when you move the mouse over them Forms that are checked before you send them away This makes webpages more responsive

We start simple JavaScript also makes it possible to add simple programs to your pages Calculator World Clock Improved navigation Games One more thing... Java has nothing to do with JavaScript. It is a full programming language

Using JavaScript JavaScript is used like CSS Internal External <style type='text/css'> code </style> <script type='text/javascript'> code </script> External <link type='text/css' href='xyz.css' rel='stylesheet'> <script type='text/javascript' src='xyz.js'></script>

Simple program <script type='text/javascript'> <!-- <body> <script type='text/javascript'> <!-- var x = 1; var y = 2; var sum = x + y; document.write( sum ); //--> </script> </body>

Comments HTML <!– This is a comment --> CSS JavaScript (and PHP) // This is a one-line comment

Simple program <script type='text/javascript'> <!-- <body> <script type='text/javascript'> <!-- var x = 1; var y = 2; var sum = 4 + x + y; document.write( sum ); //--> </script> </body>

Simple program <script type='text/javascript'> <!-- <body> <script type='text/javascript'> <!-- var x = 1; var y = 2; var sum = '1 + 2 =' + x + y; document.write( sum ); //--> </script> </body>

Dynamic typing sum = 4 + x + y; sum = '1 + 2 = ' + x + y; Variable sum becomes a number On the screen: 7 sum = '1 + 2 = ' + x + y; Variable sum becomes a string On the screen: 1 + 2 = 12 sum = '1 + 2 = ' +( x + y ); On the screen: 1 + 2 = 3 sum = x+' + '+y+' = '+(x+y);

Dynamic typing Declare a variable Assign a value var xyz; (can’t begin with number) Assign a value xyz = 12; //integer Type depends on declaration xyz = 'hello'; //string xyz = 1.5; //float xyz = true; //boolean In one go… var xyz = 'hello';

Case Sensitive! ThisVar isn’t the same as thisVar CountThisStuff() isn’t the same as countThisStuff() The thing above is a function. A function wraps up a bit of code and makes it available to use more than once. Functions are needed if you want to do something with events.

An event is triggered by something you do in HTML Events An event is triggered by something you do in HTML Mouse click Mouse over Typing On error Etc Handout!

Function <script type='text/javascript'> <!-- <head> <script type='text/javascript'> <!-- function addNumbers( n,m ) { document.write( n + m ); } //--> </script> </head>

Calling a function <body> <input type='button' onclick='addNumbers(3,4)' value='Click me!'> </body> Mind the new <input> HTML tag! Inputs are used in forms

Inputs <input type=‘x’ name=‘y’ value=‘z’> X can be Text Button Radio Checkbox Hidden Y should generally be unique in a page Z can be a preset value http://www.indeles.nl/em_a/index.php?page_id=399

Functions and scope function addNumbers( n, m ){ var result = n + m; n = 1; m = 1; return result; } var result = 0; var m = 3; var n = 4; var sum = addNumbers( n, m ); //what is the value of the variables?

Loops “Do x y times” There are also while and for/in loops. var i = 0; for ( i=1; i<=10; i++ ){ document.write( "x = "+i+"<br>" ); } There are also while and for/in loops. 19

Conditions Do x when y is true else do z var d = new Date(); //new date object var time = d.gethours(); //call method from object if (time<9){ document.write("Good morning!"); } else{ document.write("You're late!"); There are also switch statements 20

We’ll only use stuff that’s coming with JavaScript Objects and methods We’ll only use stuff that’s coming with JavaScript Date object Math object String as an object Objects have methods and properties Property is a predefine value Method is a function within an object Handout!

Methods, examples Date Math String var d=new Date(); Var str = d.getTime() + " milliseconds since 1970/01/01"); Math var r = 10; var x = Math.pow(r,2) * Math.PI; String var str = “My name Hans!"; str = str.replace("Hans", "John");

Lots of info Time for an exercise For non-Mathheads Condition 1 Fibonacci sequence 0, 1, 1, 2, 3, 5, 8, 13, 21, etc For non-Mathheads 0 + 1 = 1 1 + 1 = 2 1 + 2 = 3 2 + 3 = 5 Condition 1 I want you to use a function

Done