Web Systems & Technologies

Slides:



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

Tutorial 12 Working with Arrays, Loops, and Conditional Statements
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
Introduction to JavaScript for Python Programmers
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
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.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
LOGO Conditional Statements & Loops in JavaScript CHAPTER 10 Eastern Mediterranean University School of Computing and Technology Department of Information.
L OO P S While writing a program, there may be a situation when you need to perform some action over and over again. In such situation you would need.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
JavaScript Syntax, how to use it in a HTML document
JavaScript, Fourth Edition
JavaScript. JavaScript is the programming language of HTML and the Web. Easy to learn One of the 3 languages of all developers MUST learn: 1. HTML to.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Pertemuan 5 IT133 Pengembangan Web JavaScript. What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of 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.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
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,
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Learning Javascript From Mr Saem
JavaScript Tutorial. What is JavaScript JavaScript is the programming language of HTML and the Web Programming makes computers do what you want them to.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
JavaScript Tutorial First lecture 19/2/2016. Javascript is a dynamic computer programming language. It is lightweight and most commonly used as a part.
PHP using MySQL Database for Web Development (part II)
Build in Objects In JavaScript, almost "everything" is an object.
Web Systems & Technologies
Web Basics: HTML/CSS/JavaScript What are they?
Java Script Introduction. Java Script Introduction.
>> Introduction to JavaScript
Programming Web Pages with JavaScript
Introduction to Dynamic Web Programming
>> Introduction to CSS
HTML & teh internets.
Tutorial 12 Working with Arrays, Loops, and Conditional Statements
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Intro to JavaScript CS 1150 Spring 2017.
JAVA Script : Functions Ashima Wadhwa
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
My First Web Page document.write("" + Date() + ""); To insert.
WEB APPLICATION PROGRAMMING
JavaScript Syntax and Semantics
JavaScript Netcentric.
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
DHTML.
Web Systems & Technologies
JavaScript an introduction.
Loop Control Structure.
Programming Fundamentals Lecture #6 Program Control
Introduction to JavaScript for Python Programmers
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
JavaScript MCS/BCS.
Conditional Statements & Loops in JavaScript
CSC318 – DYNAMIC WEB APPLICATION DEVELOPMENT
Javascript.
Training & Development
PHP an introduction.
CIS 136 Building Mobile Apps
Web Programming and Design
Web Programming and Design
Introduction to Web programming
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

Web Systems & Technologies CS-3548 Prepared By: Junaid Hassan Lecturer at UOS M.B.Din Campus junaidte14@gmail.com

Introduction to JAVASCRIPT (JS) Topics: Introduction to JAVASCRIPT (JS)

Intro to JS: Programming language of HTML and Web Front end development language Used to change the layout of web page dynamically Used to add interactivity in web page

Intro to JS: JS can change HTML styles (CSS) JS can hide HTML elements JS can change HTML content JS can change HTML styles (CSS) JS can hide HTML elements JS can show HTML elements document.getElementById("demo").innerHTML = "Hello World"; document.getElementById("demo").style.backgroundColor = “red"; document.getElementById("demo").style.display = "none";

Where & How to use JS: <script> tag is used to define JS JS can be placed inside <head> tag or inside <body> tag Another way to define JS is to add JS code in external file and then reference it inside web page

JS Example: <p id="demo">A Paragraph</p> <button type="button" onclick="myFunction()">Try it</button> <script> function myFunction() {     document.getElementById("demo").innerHTML = "Paragraph changed."; } </script>

JS Output: document.getElementById("demo").innerHTML = 5 + 6; document.write(5 + 6); window.alert(5 + 6); console.log(5 + 6); <button onclick="document.write(5 + 6)">Try it</button>

JS Syntax: JS code lines are separated by semicolon (;) JS veriables are defined using ‘var’ keyword JS operators (+, -, *, /) JS expression is a combination of values, variables, and operators, which computes to a value JS comments (//, /* */) JS and CamelCase (In JS variables are defined in CamelCase e.g firstName etc.)

JS Functions: Block of code to perform some task We have to call that function to perform that task They avoid repetetion of code We can use a function multiple times in our code var x = myFunction(4, 3); function myFunction(p1, p2) {     return p1 * p2;       }

JS Arrays: A special variable which can hold multiple values at a time var items = [“item1", “item2", “item3"]; var items = [     “item1",     “item2",     “item3" ]; var items = new Array(“item1", “item2", “item3");

JS Objects: Objects are also like variables but they contain multiple values Objects contain properties + methods Properties are pairs of ‘name’ and ‘value’ Methods are functions var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:”blue”, fullName: function(){return this.firstName + “ ” + this.lastName;}}; person.firstName, person[‘firstName’] person.fullName();

JS Conditional Statements: Conditional statements are used to perform an action based on a condition If statement, else, if else, switch statements if (condition1) {     block of code to be executed if condition1 is true } else if (condition2) {     block of code to be executed if the condition1 is false and condition2 is true } else {     block of code to be executed if the condition1 is false and condition2 is false }

JS Conditional Statements: Switch statement is used to perform different actions based on different cases switch(expression) {     case n:         code block         break;     case n:         code block         break;     default:         code block }

JS Loops (For, For/In): Loops can execuste a block of code a number of times for (i = 0; i < 5; i++) {     text += "The number is " + i + "<br>"; } For/In loop is used to iterate through the properties of an object var person = {fname:"John", lname:"Doe", age:25};  var text = ""; var x; for (x in person) {     text += person[x]; }

JS Loops (While, do/while): While loop, loops through a block of code as long as the condition is true while (i < 10) {     text += "The number is " + i;     i++; } In do/while loop, block of code will be executed at least once even if the condition is false. do {     text += "The number is " + i;     i++; } while (i < 10);

References: http://w3schools.com/js