This is our seminar JavaScript And DOM This is our seminar JavaScript And DOM.

Slides:



Advertisements
Similar presentations
1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
JavaScript and the DOM Les Carr COMP3001 Les Carr COMP3001.
Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
The Web Warrior Guide to Web Design Technologies
14/11/11.  These words have special meanings in themselves  These should NOT be used as Identifiers.  For example:  Break, do, function, case, else,
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
آموزش طراحی وب سایت جلسه دهم – جاوا اسکریپت 1 تدریس طراحی وب برای اطلاعات بیشتر تماس بگیرید تاو شماره تماس: پست الکترونیک :
Javascript and the Web Whys and Hows of Javascript.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
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.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
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.
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,
What is Java Script? An extension to HTML. An extension to HTML. Allows authors to incorporate some functionality in their web pages. (without using CGI.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Using Client-Side Scripts to Enhance Web Applications 1.
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
1 JavaScript
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
Event JavaScript's interaction with HTML is handled through events that occur when the user or browser manipulates a page. When the page loads, that is.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
JavaScript Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
COMP403 Web Design JAVA SCRİPTS Tolgay KARANFİLLER.
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
Jaana Holvikivi 1 Introduction to Javascript Jaana Holvikivi Metropolia.
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.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
7. JavaScript Events. 2 Motto: Do you think I can listen all day to such stuff? –Lewis Carroll.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
 objects in Client  What is Event?  Event Handlers  programming.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Introduction to JavaScript Events Instructor: Sergey Goldman 1.
Tarik Booker CS 120 California State University, Los Angeles.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Introduction to.
Programming Web Pages with JavaScript
CHAPTER 10 JAVA SCRIPT.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Unit M Programming Web Pages with
JavaScript is a programming language designed for Web pages.
Unit M Programming Web Pages with
Intro to JavaScript CS 1150 Spring 2017.
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript.
JavaScript Introduction
JavaScript CS 4640 Programming Languages for Web Applications
Tutorial 10: Programming with javascript
Introduction to Programming and JavaScript
Web Programming– UFCFB Lecture 13
Web Programming and Design
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

This is our seminar JavaScript And DOM This is our seminar JavaScript And DOM

Member: Hu ỳ nh Qu ố c Thanh Thái Thánh Tr ị

Main content What’s JavaScript? Different between ID and Name Method getElementById () and getElementsByName (). How to manipulate properties of HTML tags? Events of JavaScript.

Main content What’s JavaScript? Different between ID and Name. Method Method getElementById () and getElementsByName (). How to manipulate properties of HTML tags? Events of JavaScript.

What’s JavaScript? JavaScript is designed to interact with the HTML page. JavaScript is usually embedded directly into HTML pages. JavaScript is a scripting language(scripting language is the small language program) JavaScript is a language interpreter (ie the script is executed without compiling first). JavaScript and Java are two completely different language about the content and design.

JavaScript do for: JavaScript provides the HTML design a programming tool - HTML design people often are not programmers, but JavaScript is a scripting language with syntax very easy. Most people can put the code is in your HTML pages. JavaScript can add text to the HTML page JavaScript can interact with the event - A short code can be executed when events occur, such as: load complete page or click on a certain HTML element. JavaScript can read write the HTML element - JavaScript can read and change the HTML element. JavaScript can be used to pass data - JavaScript can be used to standardize data for the server to avoid multiple handling. JavaScript can be used to create cookie - JavaScript can store and get information on the client.

Placing JavaScript in HTML Using tag tag to insert JavaScript into HTML pages EX: document.write("Hello World!")

JavaScript code executed outside When you want to execute the JavaScript on several pages that we should write a script file *. js, then call the properties that it used "src". *. Js file does not contain tag Example: For example, the javascript code stored in the file test.js as follows: document.write ( "This script is external") Call the script using attribute "src" from HTML

Placement JavaScript code Placed between tag and : the script will execute as soon as the page is opened. Placed between tag and : The script in the body is executed when the page is open. Placed between tag and or and : The script can be placed in the head or the body of the HTML tag. Number of the script is not limited.

Operator OperatorDescriptionSampleResults + Sum x= 2+2 s = “2” + “2” x=4 x=“22” - Subtraction x=2 5-x 3 * Multiplication x=4 x*5 20 / Division 15/5 5/ % Get the balance of the division 5%2 10%8 10% An increase x=5 x++ X=6 -- Reduced to a x=5 x-- X=4

Operator assigned OperatorSampleOperation equivalent =X=Y +=X+=YX=X+Y -=X-=YX=X-Y *=X*=YX=X*Y /=X/=YX=X/Y %=X%=YX=X%Y

Comparison operators OperatorDescriptionSample ==compared with 5==8 returns false !=compared with 5!=8 returns true >larger 5>8 returns false <smaller 5<8 returns true >=Greater than or equal 5>=8 returns false <=less than or equal 5<=8 returns true

Logical operator OperatorDescriptionSample && Authority AND. x=6 y=3 (x 1) return TRUE || Authority OR x=6 y=3 (x==5 || y==5) return false ! Authority NOT x=6 y=3 x != y return true

Operator on the variable type string Used to "+" to link the chain together Ex txt1 = "What a very"; txt2 = "nice day!"; txt3 = txt1 + txt2; / / Results txt3 = "verynice What a day!".

Conditional statements If…else if (condition) { // code to be executed if condition is true } switch switch(n) { case 1: execute code block 1 break; case 2: execute code block 2 break; default: code to be executed if n is different from case 1 and 2 }

JavaScript loops For loop for (var = startvalue; var <= endvalue; var = increment) { // code to be executed } While loop while (var<=endvalue) { // code to be executed } For…In for (variable in object) { // code to be executed }

Some examples

Main content What’s JavaScript? Different between ID and Name. Method Method getElementById () and getElementsByName (). How to manipulate properties of HTML tags? Events of JavaScript.

Different between ID and Name ID and Name are two identifiers to retrieve values [values] of a certain object. Id commonly used in the DOM structure for access to the object (,,...) with the aim may be (add / delete / milk) content of the object. Name: identifier for the element of the form (,,...) Each object has only one unique id. Often used in the CSS id for the object's calculated only on the page (eg frame edges (wrapper), the main menu (main menu ),...). Name of the card can overlap.

Main content What’s JavaScript? Different between ID and Name. Method Method getElementById () and getElementsByName (). How to manipulate properties of HTML tags? Events of JavaScript.

Method getElementById () and getElementsByName () Method getElementById () and getElementsByName () is used to access the HTML tags. getElementById ( "id") to access a card with the id specified. getElementsByName ( "Name") to get on the list of cards with the card attribute "name" parameter "Name" of the function.

Ex: Use getElementById() getElementById example Function{ changeColor(newColor){ elem = document.getElementById("para1"); elem.style.color = newColor;} Some text here blue red

Ex: use getElementsByIName() // return some of the forms // // up_forms = document.getElementsByName("up");

Main content What’s JavaScript? Different between ID and Name. Method Method getElementById () and getElementsByName (). How to manipulate properties of HTML tags? Events of JavaScript.

Manipulate HTML properties Use tag. Use methods in JavaScript. ◦ setAttribute(). ◦ getAttribute(). ◦ removeAttribute(). Use HTML DOM objects.

Manipulate HTML properties… Use methods in JavaScript. ◦ getAttribute(). ◦ setAttribute(). ◦ removeAttribute(). Ex: getAttribute() //returns "test.gif“ getvalue=document.getElementById("myimage").g etAttribute("src")

Manipulate HTML properties… Ex: setAttribute() document.getElementById("myimage").set Attribute(“otherImage.gif");

Manipulate properties (cont…) Use HTML DOM objects. ◦ objectName.propertyName = value Ex: document.getElementById(“link").href=“new_lin k.html“

Main content What’s JavaScript? Different between ID and Name. Method Method getElementById () and getElementsByName (). How to manipulate properties of HTML tags? Events of JavaScript.

Events Every element on a web page has certain events which can trigger a javascript. Examples of events: ◦ A mouse click ◦ A web page or an image loading ◦ Mousing over a hot spot on the web page ◦ Selecting an input field in an HTML form ◦ Submitting an HTML form ◦ A keystroke

Events… EventDescription onblurAn element loses focus onerrorAn error occurs onfocusAn element gains focus onloadThe document has completely loaded onresetA form reset command is issued onscrollThe document is scrolled onselectThe selection of element has changed onsubmitA form submit command is issued

Events Keyboard EventDescription onkeydownA key has been pressed onkeypressonkeydown followed by onkeyup onkeyupA key has been released Mouse EventDescription onmousedownA mouse button has been pressed onmousemoveThe mouse has been moved onmouseoutThe mouse pointer has left an element onmouseoverThe mouse pointer has entered an element onmouseupA mouse button has been released onclickA mouse button has been clicked ondblclickA mouse button has been double-clicked (clicked twice rapidly)

DEMO

The end Thank for your attention!