E-commerce Applications Development

Slides:



Advertisements
Similar presentations
JavaScript – Quiz #8 Lecture Code:
Advertisements

Getting Started with jQuery. 1. Introduction to jQuery 2. Selection and DOM manipulation Contents 2.
The jQuery library. What is jQuery ? A javascript lightweight library Is very easy to use Is powerful Is cross-browser compatible Downloadable from jQuery.com,
Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
JQuery A Javascript Library Hard things made eas(ier) Norman White.
CS7026 jQuery Events. What are Events?  jQuery is tailor-made to respond to events in an HTML page.  Events are actions that can be detected by your.
JQUERY/AJAX ALIREZA KHATAMIAN DELARAM YAZDANSEPAS.
CS428 Web Engineering Lecture 15 Introduction to Jquery.
Philly.NET Hands-On jQuery + Plug-ins Bill Wolff, Rob Keiser.
Anatomy of an App HTML, CSS, jQuery, jQuery Mobile CIS 136 Building Mobile Apps 1.
M. Taimoor Khan Courtesy: Norman White.
JQuery March 09 th,2009 Create by
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
CSS Class 7 Add JavaScript to your page Add event handlers Validate a form Open a new window Hide and show elements Swap images Debug JavaScript.
Jquery Nasrullah. Jquery jQuery is a JavaScript Library. jQuery greatly simplifies JavaScript programming. jQuery is easy to learn.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
Animation & Effects Using JQuery. What is jQuery? jQuery is a lightweight, JavaScript library. The purpose of jQuery is to make it much easier to use.
JQuery Youn-Hee Han
CHAPTER 5 jQuery อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
JQuery Introduction © Copyright 2014, Fred McClurg All Rights Reserved.
Browser scripting jQuery Edited by: Trần Thị Mỹ Dung Ref:w3schools.com.
JavaScript Library. What is jQuery jQuery is a lightweight JavaScript library. The purpose is to make it easier to use JavaScript code on your website.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
Web Programming Language Week 9 Dr. Ken Cosh Introducing jQuery.
Creating Dynamic Webpages
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
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 Technologies Lecture 8 JQuery. “A fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax.
Introduction to JQuery COGS 187A – Fall JQuery jQuery is a JavaScript library, and allows us to manipulate HTML and CSS after the page has been.
KAPITA SELEKTA INFORMATIKA Lasmedi Afuan, ST.M.Cs.
JQuery Tutorial. What is jQuery jQuery is a JavaScript Library The purpose of jQuery is to make it much easier to use JavaScript on your website JavaScript.
JQuery is a fast, small, and feature-rich javascript library. It makes things like HTML document traversal and manipulation, event handling, animation,
JQuery.
What is jQuery?.
Build in Objects In JavaScript, almost "everything" is an object.
Introduction to Web programming
Week 3: Introduction to Javascript
-By Yogita Nirmal.
Tek Raj Chhetri Code for Humans not for machine.
Week 4: Introduction to Javascript
Intro to jQuery jQuery is a popular, and extensible, JavaScript library Supports … DOM manipulation CSS manipulation HTML event methods Effects & animations.
Introduction to Web programming
JQuery.
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
The Cliff Notes Version
JavaScript Introduction
HTML Level II (CyberAdvantage)
Understanding JavaScript and Coding Essentials
Your 1st Programming Assignment
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
JQuery with ASP.NET.
Functions, Regular expressions and Events
Web Programming Language
..
Document Object Model.
Web Programming Language
Code Topic 9 Standard JavaScript Events Laura Friedman
Tutorial 10: Programming with javascript
Chengyu Sun California State University, Los Angeles
CS7026 jQuery Events.
Introduction to jQuery
Web Client Side Technologies Raneem Qaddoura
Web Programming and Design
Week 5: Recap and Portfolio Site
SEEM4540 Tutorial 3 jQuery Wong Wai Chung.
Web Programming and Design
Web Programming and Design
Introduction to Web programming
JQuery.
Presentation transcript:

E-commerce Applications Development 0731465

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

Lecture 2 JQuery

What is jQuery? jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on your website. jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code. jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and HTML manipulation. The jQuery library contains the following features: HTML manipulation CSS manipulation HTML event methods Effects and animations AJAX Utilities

Adding jQuery to Your Web Pages Two ways Download the jQuery library from jQuery.com Include jQuery from a CDN (Content Delivery Network), like Google <head> <script src="jquery-3.2.1.min.js"></script> </head> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head>

jQuery Syntax The jQuery syntax is tailor-made for selecting HTML elements and performing some action on the element(s). Basic syntax is: $(selector).action() A $ sign to define/access jQuery A (selector) to "query (or find)" HTML elements A jQuery action() to be performed on the element(s) Examples: $(this).hide() - hides the current element. $("p").hide() - hides all <p> elements. $(".test").hide() - hides all elements with class="test". $("#test").hide() - hides the element with id="test".

jQuery Selectors The element Selector: The jQuery element selector selects elements based on the element name. The #id Selector: The jQuery #id selector uses the id attribute of an HTML tag to find the specific element. The .class Selector: The jQuery class selector finds elements with a specific class. $("p").hide(); $("#test").hide(); $(".test").hide();

jQuery Events Mouse Events Keyboard Events Form Events Document/Window Events click keypress submit load dblclick keydown change resize mouseenter keyup focus scroll mouseleave   blur unload Ready Event: This is to prevent any jQuery code from running before the document is finished loading (is ready). $(document).ready(function(){ $("p").click(function(){ $(this).hide(); });

Set Content and Attributes text() - Sets or returns the text content of selected elements html() - Sets or returns the content of selected elements (including HTML markup) val() - Sets or returns the value of form fields $(“p").click(function(){     $("#test1").text("Hello world!"); }); $(“p").click(function(){     $("#test2").html("<b>Hello world!</b>"); }); $(“p").click(function(){     $("#test3").val("Dolly Duck"); }); CSS

access and manipulate elements and attributes Get: text(), html(), val(), and attr(): details Set: text(), html(), val(), and attr(): details Add: append(), prepend(), after(), and before(): details Remove: remove() and empty(): details Get and Set CSS: addClass(), removeClass(), and toggleClass(): details Get and Set CSS: css(): details Dimensions: width(), height(), innerWidth(), innerHeight(), outerWidth(), and outerHeight(): details

jQuery Example <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); </script> </head> <body> <p>If you click on me, I will disappear.</p> <p>Click me away!</p> <p>Click me too!</p> </body> </html>

References https://www.w3schools.com/ Robin Nixon, Learning PHP, MySQL, JavaScript, and CSS, 2013

The End