Introduction to Web programming

Slides:



Advertisements
Similar presentations
Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
Advertisements

The Web Warrior Guide to Web Design Technologies
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
Introduction to JavaScript Gordon Tian
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
Introduction to the Document Object Model DOM *Understand document structure manipulation *Dynamic effects in web pages *Programming, scripting, web content.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
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".
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Understanding JavaScript and Coding Essentials Lesson 8.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
Servlets What is a Servlet?
Introduction to.
Build in Objects In JavaScript, almost "everything" is an object.
Introduction to Web programming
Week 3: Introduction to Javascript
Unit M Programming Web Pages with
Web Systems & Technologies
Chapter 6 JavaScript: Introduction to Scripting
Week 4: Introduction to Javascript
JavaScript is a programming language designed for Web pages.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Intro to JavaScript CS 1150 Spring 2017.
Introduction to Web programming
Web Development & Design Foundations with HTML5 7th Edition
JavaScript Functions.
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
DHTML.
JavaScript Introduction
DHTML Javascript Internet Technology.
Understanding JavaScript and Coding Essentials
Your 1st Programming Assignment
Event Driven Programming & User Defined Functions
DHTML Javascript Internet Technology.
PHP.
Functions, Regular expressions and Events
JavaScript MCS/BCS.
Web Design and Development
Training & Development
Tutorial 6 PHP & MySQL Li Xu
E-commerce Applications Development
Code Topic 9 Standard JavaScript Events Laura Friedman
JavaScript CS 4640 Programming Languages for Web Applications
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript and Ajax (JavaScript Events)
Web Client Side Technologies Raneem Qaddoura
Web Programming and Design
Week 5: Recap and Portfolio Site
Web Programming and Design
Web Programming and Design
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Introduction to Web programming 0731213

Lecture 1 Javascript

Why Study JavaScript? JavaScript is very easy to learn. No setup is required. Widely accepted by most of the Web browsers Interaction at client side with the user is made more interesting and more easier Make actions in the user's browser without sending messages back and forth to the server. JavaScript also allows your page to be interactive. Provide responses within the Web page to various actions that your visitor takes so as to avoid the need to load new Web pages to respond (AJAX). Considering the performance, JavaScript is fast and Reliable.

Introduction JavaScript Can Change HTML Content One of many JavaScript HTML methods is getElementById(). This example uses the method to "find" an HTML element (with id="demo") and changes the element content (innerHTML) to "Hello JavaScript": JavaScript Can Change HTML Styles (CSS) Changing the style of an HTML element, is a variant of changing an HTML attribute document.getElementById("demo").innerHTML = "Hello JavaScript"; document.getElementById('demo').innerHTML = 'Hello JavaScript’; JavaScript accepts both double and single quotes document.getElementById("demo").style.fontSize = "25px";

Introduction JavaScript Can Hide or Show HTML Elements Hiding HTML elements can be done by changing the display style document.getElementById("demo").style.display = "none"; document.getElementById("demo").style.display = "block";

Where to put JavaScript The <script> Tag In HTML, JavaScript code must be inserted between <script> and </script> tags. You can place any number of scripts in an HTML document. Scripts can be placed in the <body>, or in the <head> section of an HTML page, or in both. <script> document.getElementById("demo").innerHTML = "My First JavaScript"; </script>

JavaScript Functions A JavaScript function is a block of code designed to perform a particular task. A JavaScript function is executed when "something" invokes it (calls it). A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses (). Function names can contain letters, digits, underscores, and dollar signs (same rules as variables). The parentheses may include parameter names separated by commas: (parameter1, parameter2, ...) The code to be executed, by the function, is placed inside curly brackets: {} function myFunction(p1, p2) {     return p1 * p2;              // The function returns the product of p1 and p2 }

JavaScript Events HTML events are "things" that happen to HTML elements. When JavaScript is used in HTML pages, JavaScript can "react" on these events. <element event='some JavaScript’> <input type=text onmouseover="document.getElementById('demo').innerHTML = ‘Hello’ "/> <input type=text onmouseover=“changeText()"/>

JavaScript Example <html> <head> <script> function changeText1() {document.getElementById("demo").innerHTML = "Your mouse is here.";} function changeText2() {document.getElementById("demo").innerHTML = "Your mouse left.";} </script> </head> <body> <h1>A Web Page</h1> <p id="demo">A Paragraph</p> <input type=text onmouseover="changeText1()" onmouseout="changeText2()"/> </body> </html>

Common HTML Events Event Description onchange An HTML element has been changed onclick The user clicks an HTML element onmouseover The user moves the mouse over an HTML element onmouseout The user moves the mouse away from an HTML element onkeydown The user pushes a keyboard key onload The browser has finished loading the page

References https://www.w3schools.com/ Robin Nixon, Learning PHP, MySQL, JavaScript, and CSS, 2013 Mike McGrath, PHP & My SQL in easy steps, 2012.