Download presentation
Presentation is loading. Please wait.
Published bySilas George Modified over 9 years ago
1
Web Application Development Muhammad Ali Versonic Pte Asher Imtiaz Forman Christian College
2
Action Event Handling (Also called as handler) Function
3
function anyFunction() { alert(“Inside anyFunction”); } function sum(num1, num2) { return num1 + num2; }
4
function calculateGrade(marks) { if (marks >= 90 && marks <= 100) { return “A”; } else if (marks >= 80) { return “B”; } else if (marks >= 70) { return “Pass”; }
5
API (Application Programming Interface) For how JavaScript Programs can access and manipulate the HTML Document DOM Standardization
6
▪ DOM – 1 (1998) ▪ Complete model for an entire HTML or XML document, including means to change any portion of the document. ▪ DOM-2 (late 2000) ▪ getElementById ▪ Event model ▪ CSS ▪ DOM-3 ▪ Xpath ▪ Keyboard Event Handling
7
source: wikipedia
8
source: wikipedia
10
source: wikipedia
11
Window Object source: wikipedia
12
History Object source: w3schools
13
Location Object source: w3schools
14
Window Object source: w3schools
15
Cont.. source: w3schools
16
Detecting Browser Version navigator.appName navigator.appVersion navigator.userAgent
17
My Title My link My header
18
Source: w3schools.com
19
getElementByTagId getElementsByTagName Traverse the DOM Tree
20
function addElement() { var newdiv = document.createElement(“div”); newdiv.setAttribute(“id”,”myDiv”); newdiv.innerHTML = “Element added!”; }
21
function removeElement(divToRemove) { var parentDiv = document.getElementById('myDiv'); parentDiv.removeChild(divToRemove); }
22
var button = window.getElementById(“msgButton”); button.addEventListener(“click”, sayHello, false); function sayHello() { window.alert(“Hello”); }
23
removeEventListener The event listener will no longer exist!
24
Quirksmode - DOM Traversal [ http://www.quirksmode.org/dom/intro.html ] w3schools - DOM Tutorials [ http://www.w3schools.com/HTMLDOM/dom_examples.asp ] MREDKJ - DOM Tutorials [ http://www.mredkj.com/tutorials/htmljs.html ]
25
Sets the timeout for the function var tid = setTimeout("timedCount()", 1000); Clears the timout clearTimeout(tid);
26
Aptana Debugger Firebug Extension for Firefox
27
Breakpoints Call Stack Watch & Inspect Step-into, Step-over, Step-out
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.