SlideShare a Scribd company logo
1 of 12
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
Hidaya Institute of
Science &
Technology
www.histpk.org
A Division of Hidaya Trust, Pakistan
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
JAVASCRIPT
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
DIALOG BOX
Alert Dialog Box:
•An alert dialog box is mostly used to give a warning message to
the users. Like if one input field requires to enter some text but
user does not enter that field then as a part of validation you
can use alert box to give warning message
alert(“text”);
Confirmation Dialog Box:
•A confirmation dialog box is mostly used to take user's consent on any
option. It displays a dialog box with two buttons: OK and Cancel.
•If the user clicks on OK button the window method confirm() will
return true. If the user clicks on the Cancel button confirm() returns
false. You can use confirmation dialog box
confirm(“Message");
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
DIALOG BOX
•Prompt Dialog Box:
•The prompt dialog box is very useful when you want to pop-up
a text box to get user input. Thus it enable you to interact with
the user. The user needs to fill in the field and then click OK.
•This dialog box is displayed using a method
called prompt() which takes two parameters (i) A label which
you want to display in the text box (ii) A default string to display
in the text box.
•This dialog box with two buttons: OK and Cancel. If the user
clicks on OK button the window method prompt() will return
entered value from the text box. If the user clicks on the Cancel
button the window method prompt() returns null.
•prompt(“Message At top", “Name In Field");
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
FUNCTIONS
•A function is a group of reusable code which can be called
anywhere in your program. This eliminates the need of writing
same code again and again.
•Help programmers to write modular code.
•Can easily divide your big program in a number of small and
manageable functions.
•Like any other advance programming language, JavaScript also
supports all the features necessary to write modular code using
functions.
•You must have seen functions like alert() and write(), We are
using these function again and again but they have been written
in core JavaScript only once.
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
FUNCTIONS
•The most common way to define a function in JavaScript is by using
the function keyword, followed by a unique function name, a list of
parameters (that might be empty), and a statement block surrounded
by curly braces.
•The basic syntax is shown here:
function functionname(parameter-list)
{
statements
}
Calling a Function:
•To invoke a function somewhere later in the script, you would simple
need to write the name of that function as follows:
functionname();
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
FUNCTIONS
Function Parameters:
•There is a facility to pass different parameters while calling a function.
•These passed parameters can be captured inside the function and any
manipulation can be done over those parameters.
•A function can take multiple parameters separated by comma.
function functionname(para1,para2)
{
statements
}
The return Statement:
A JavaScript function can have an optional return statement. This is
required if you want to return a value from a function. This statement
should be the last statement in a function.
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
EVENTS IN JAVASCRIPT
•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 an event.
•When the user clicks a button, that click, too, is an event.
• Another example of events are like:
• pressing any key
• closing window
• resizing window.
•Developers can use these events to execute JavaScript coded
responses, which cause buttons to close windows, messages to
be displayed to users, data to be validated, and virtually any
other type of response imaginable to occur.
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
HTML 4 STANDARD EVENTS
Event Value Description
onchange script Script runs when the element changes
onsubmit script Script runs when the form is submitted
onreset script Script runs when the form is reset
onselect script Script runs when the element is selected
onblur script Script runs when the element loses focus
onfocus script Script runs when the element gets focus
onkeydown script Script runs when key is pressed
onkeypress script Script runs when key is pressed and released
onkeyup script Script runs when key is released
onclick script Script runs when a mouse click
ondblclick script Script runs when a mouse double-click
onmousedown script Script runs when mouse button is pressed
onmousemove script Script runs when mouse pointer moves
onmouseout script Script runs when mouse pointer moves out of an element
onmouseover script Script runs when mouse pointer moves over an element
onmouseup script Script runs when mouse button is released
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
DOCUMENT OBJECT MODEL
•Every web page resides inside a browser window which can be considered as an object.
•A Document object represents the HTML document that is displayed in that window.
•The Document object has various properties that refer to other objects which allow access
to and modification of document content.
•The way that document content is accessed and modified is called the Document Object
Model, or DOM. The Objects are organized in a hierarchy.
• This hierarchical structure applies to the organization of objects in a Web document.
•Window object: Top of the hierarchy. It is the outmost element of the object hierarchy.
•Document object: Each HTML document that gets loaded into a window becomes a
document object. The document contains the content of the page.
•Form object: Everything enclosed in the <form>...</form> tags sets the form object.
•Form control elements: The form object contains all the elements defined for that object
such as text fields, buttons, radio buttons, and checkboxes.
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org

More Related Content

Viewers also liked

Javascript lecture 3
Javascript lecture 3Javascript lecture 3
Javascript lecture 3Mudasir Syed
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4Mudasir Syed
 
String functions and operations
String functions and operations String functions and operations
String functions and operations Mudasir Syed
 
Css presentation lecture 4
Css presentation lecture 4Css presentation lecture 4
Css presentation lecture 4Mudasir Syed
 
Sessions in php
Sessions in php Sessions in php
Sessions in php Mudasir Syed
 
Functions in php
Functions in phpFunctions in php
Functions in phpMudasir Syed
 
String functions and operations
String functions and operations String functions and operations
String functions and operations Mudasir Syed
 
Javascript lecture 4
Javascript lecture  4Javascript lecture  4
Javascript lecture 4Mudasir Syed
 
Form validation with built in functions
Form validation with built in functions Form validation with built in functions
Form validation with built in functions Mudasir Syed
 
Form validation server side
Form validation server side Form validation server side
Form validation server side Mudasir Syed
 
loops and branches
loops and branches loops and branches
loops and branches Mudasir Syed
 
Web forms and html lecture Number 3
Web forms and html lecture Number 3Web forms and html lecture Number 3
Web forms and html lecture Number 3Mudasir Syed
 
introduction to programmin
introduction to programminintroduction to programmin
introduction to programminMudasir Syed
 
Form validation client side
Form validation client side Form validation client side
Form validation client side Mudasir Syed
 
Web forms and html lecture Number 2
Web forms and html lecture Number 2Web forms and html lecture Number 2
Web forms and html lecture Number 2Mudasir Syed
 

Viewers also liked (16)

Javascript lecture 3
Javascript lecture 3Javascript lecture 3
Javascript lecture 3
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
 
String functions and operations
String functions and operations String functions and operations
String functions and operations
 
Css presentation lecture 4
Css presentation lecture 4Css presentation lecture 4
Css presentation lecture 4
 
Sessions in php
Sessions in php Sessions in php
Sessions in php
 
Functions in php
Functions in phpFunctions in php
Functions in php
 
PHP array 1
PHP array 1PHP array 1
PHP array 1
 
String functions and operations
String functions and operations String functions and operations
String functions and operations
 
Javascript lecture 4
Javascript lecture  4Javascript lecture  4
Javascript lecture 4
 
Form validation with built in functions
Form validation with built in functions Form validation with built in functions
Form validation with built in functions
 
Form validation server side
Form validation server side Form validation server side
Form validation server side
 
loops and branches
loops and branches loops and branches
loops and branches
 
Web forms and html lecture Number 3
Web forms and html lecture Number 3Web forms and html lecture Number 3
Web forms and html lecture Number 3
 
introduction to programmin
introduction to programminintroduction to programmin
introduction to programmin
 
Form validation client side
Form validation client side Form validation client side
Form validation client side
 
Web forms and html lecture Number 2
Web forms and html lecture Number 2Web forms and html lecture Number 2
Web forms and html lecture Number 2
 

Similar to Javascript 2

Learn Javascript Basics
Learn Javascript BasicsLearn Javascript Basics
Learn Javascript BasicsKhushiar
 
Hsc IT Chap 3. Advanced javascript-1.pdf
Hsc IT Chap 3. Advanced javascript-1.pdfHsc IT Chap 3. Advanced javascript-1.pdf
Hsc IT Chap 3. Advanced javascript-1.pdfAAFREEN SHAIKH
 
INTERNSHIP PPT - INFOLABZ.pptx
INTERNSHIP PPT - INFOLABZ.pptxINTERNSHIP PPT - INFOLABZ.pptx
INTERNSHIP PPT - INFOLABZ.pptxDevChaudhari15
 
216170316007.pptx
216170316007.pptx216170316007.pptx
216170316007.pptxDevChaudhari15
 
Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps QuicklyGil Irizarry
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump StartHaim Michael
 
Free and Open Source Software
Free and Open Source SoftwareFree and Open Source Software
Free and Open Source SoftwareMoinuddin Ahmed
 
Done in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easyDone in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easyRoel Hartman
 
Techjoomla Infrastructure Extensions - Adding an Enterprise Layer to Joomla!
Techjoomla Infrastructure Extensions - Adding an Enterprise Layer to Joomla!Techjoomla Infrastructure Extensions - Adding an Enterprise Layer to Joomla!
Techjoomla Infrastructure Extensions - Adding an Enterprise Layer to Joomla!Parth Lawate
 
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Chris Laning
 
MAST Portal: drivers and recommendations
MAST Portal: drivers and recommendations  MAST Portal: drivers and recommendations
MAST Portal: drivers and recommendations Alberto Conti
 
Joget Workflow v6 Training Slides - 8 - Designing your First Userview
Joget Workflow v6 Training Slides - 8 - Designing your First UserviewJoget Workflow v6 Training Slides - 8 - Designing your First Userview
Joget Workflow v6 Training Slides - 8 - Designing your First UserviewJoget Workflow
 
Mychoice -classified site for buying, selling, rent etc
Mychoice -classified site for buying, selling, rent etcMychoice -classified site for buying, selling, rent etc
Mychoice -classified site for buying, selling, rent etcNikhil Palyekar
 
Basic iOS Training with SWIFT - Part 4
Basic iOS Training with SWIFT - Part 4Basic iOS Training with SWIFT - Part 4
Basic iOS Training with SWIFT - Part 4Manoj Ellappan
 
JavaScript: Implementations And Applications
JavaScript: Implementations And ApplicationsJavaScript: Implementations And Applications
JavaScript: Implementations And ApplicationsPragya Pai
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Gil Irizarry
 
Automation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional TesterAutomation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional TesterVijayChowthri Nagaprakasham
 

Similar to Javascript 2 (20)

Learn Javascript Basics
Learn Javascript BasicsLearn Javascript Basics
Learn Javascript Basics
 
Hsc IT Chap 3. Advanced javascript-1.pdf
Hsc IT Chap 3. Advanced javascript-1.pdfHsc IT Chap 3. Advanced javascript-1.pdf
Hsc IT Chap 3. Advanced javascript-1.pdf
 
INTERNSHIP PPT - INFOLABZ.pptx
INTERNSHIP PPT - INFOLABZ.pptxINTERNSHIP PPT - INFOLABZ.pptx
INTERNSHIP PPT - INFOLABZ.pptx
 
216170316007.pptx
216170316007.pptx216170316007.pptx
216170316007.pptx
 
Google Assistant Revolution
Google Assistant RevolutionGoogle Assistant Revolution
Google Assistant Revolution
 
Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps Quickly
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump Start
 
Free and Open Source Software
Free and Open Source SoftwareFree and Open Source Software
Free and Open Source Software
 
Raja3Years
Raja3YearsRaja3Years
Raja3Years
 
Done in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easyDone in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easy
 
Techjoomla Infrastructure Extensions - Adding an Enterprise Layer to Joomla!
Techjoomla Infrastructure Extensions - Adding an Enterprise Layer to Joomla!Techjoomla Infrastructure Extensions - Adding an Enterprise Layer to Joomla!
Techjoomla Infrastructure Extensions - Adding an Enterprise Layer to Joomla!
 
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
 
MAST Portal: drivers and recommendations
MAST Portal: drivers and recommendations  MAST Portal: drivers and recommendations
MAST Portal: drivers and recommendations
 
Joget Workflow v6 Training Slides - 8 - Designing your First Userview
Joget Workflow v6 Training Slides - 8 - Designing your First UserviewJoget Workflow v6 Training Slides - 8 - Designing your First Userview
Joget Workflow v6 Training Slides - 8 - Designing your First Userview
 
Mychoice -classified site for buying, selling, rent etc
Mychoice -classified site for buying, selling, rent etcMychoice -classified site for buying, selling, rent etc
Mychoice -classified site for buying, selling, rent etc
 
Basic iOS Training with SWIFT - Part 4
Basic iOS Training with SWIFT - Part 4Basic iOS Training with SWIFT - Part 4
Basic iOS Training with SWIFT - Part 4
 
JavaScript: Implementations And Applications
JavaScript: Implementations And ApplicationsJavaScript: Implementations And Applications
JavaScript: Implementations And Applications
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
 
Dom
DomDom
Dom
 
Automation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional TesterAutomation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional Tester
 

More from Mudasir Syed

Error reporting in php
Error reporting in php Error reporting in php
Error reporting in php Mudasir Syed
 
Cookies in php lecture 2
Cookies in php  lecture  2Cookies in php  lecture  2
Cookies in php lecture 2Mudasir Syed
 
Cookies in php lecture 1
Cookies in php lecture 1Cookies in php lecture 1
Cookies in php lecture 1Mudasir Syed
 
Reporting using FPDF
Reporting using FPDFReporting using FPDF
Reporting using FPDFMudasir Syed
 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2Mudasir Syed
 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2Mudasir Syed
 
Filing system in PHP
Filing system in PHPFiling system in PHP
Filing system in PHPMudasir Syed
 
Time manipulation lecture 2
Time manipulation lecture 2Time manipulation lecture 2
Time manipulation lecture 2Mudasir Syed
 
Time manipulation lecture 1
Time manipulation lecture 1 Time manipulation lecture 1
Time manipulation lecture 1 Mudasir Syed
 
Adminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdminAdminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdminMudasir Syed
 
PHP mysql Sql
PHP mysql  SqlPHP mysql  Sql
PHP mysql SqlMudasir Syed
 
PHP mysql Mysql joins
PHP mysql  Mysql joinsPHP mysql  Mysql joins
PHP mysql Mysql joinsMudasir Syed
 
PHP mysql Introduction database
 PHP mysql  Introduction database PHP mysql  Introduction database
PHP mysql Introduction databaseMudasir Syed
 
PHP mysql Installing my sql 5.1
PHP mysql  Installing my sql 5.1PHP mysql  Installing my sql 5.1
PHP mysql Installing my sql 5.1Mudasir Syed
 
PHP mysql Er diagram
PHP mysql  Er diagramPHP mysql  Er diagram
PHP mysql Er diagramMudasir Syed
 
PHP mysql Database normalizatin
PHP mysql  Database normalizatinPHP mysql  Database normalizatin
PHP mysql Database normalizatinMudasir Syed
 
PHP mysql Aggregate functions
PHP mysql Aggregate functionsPHP mysql Aggregate functions
PHP mysql Aggregate functionsMudasir Syed
 

More from Mudasir Syed (20)

Error reporting in php
Error reporting in php Error reporting in php
Error reporting in php
 
Cookies in php lecture 2
Cookies in php  lecture  2Cookies in php  lecture  2
Cookies in php lecture 2
 
Cookies in php lecture 1
Cookies in php lecture 1Cookies in php lecture 1
Cookies in php lecture 1
 
Ajax
Ajax Ajax
Ajax
 
Reporting using FPDF
Reporting using FPDFReporting using FPDF
Reporting using FPDF
 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2
 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2
 
Filing system in PHP
Filing system in PHPFiling system in PHP
Filing system in PHP
 
Time manipulation lecture 2
Time manipulation lecture 2Time manipulation lecture 2
Time manipulation lecture 2
 
Time manipulation lecture 1
Time manipulation lecture 1 Time manipulation lecture 1
Time manipulation lecture 1
 
Php Mysql
Php Mysql Php Mysql
Php Mysql
 
Adminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdminAdminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdmin
 
Sql select
Sql select Sql select
Sql select
 
PHP mysql Sql
PHP mysql  SqlPHP mysql  Sql
PHP mysql Sql
 
PHP mysql Mysql joins
PHP mysql  Mysql joinsPHP mysql  Mysql joins
PHP mysql Mysql joins
 
PHP mysql Introduction database
 PHP mysql  Introduction database PHP mysql  Introduction database
PHP mysql Introduction database
 
PHP mysql Installing my sql 5.1
PHP mysql  Installing my sql 5.1PHP mysql  Installing my sql 5.1
PHP mysql Installing my sql 5.1
 
PHP mysql Er diagram
PHP mysql  Er diagramPHP mysql  Er diagram
PHP mysql Er diagram
 
PHP mysql Database normalizatin
PHP mysql  Database normalizatinPHP mysql  Database normalizatin
PHP mysql Database normalizatin
 
PHP mysql Aggregate functions
PHP mysql Aggregate functionsPHP mysql Aggregate functions
PHP mysql Aggregate functions
 

Recently uploaded

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 

Recently uploaded (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 

Javascript 2

  • 1. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org Hidaya Institute of Science & Technology www.histpk.org A Division of Hidaya Trust, Pakistan
  • 2. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org JAVASCRIPT
  • 3. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org DIALOG BOX Alert Dialog Box: •An alert dialog box is mostly used to give a warning message to the users. Like if one input field requires to enter some text but user does not enter that field then as a part of validation you can use alert box to give warning message alert(“text”); Confirmation Dialog Box: •A confirmation dialog box is mostly used to take user's consent on any option. It displays a dialog box with two buttons: OK and Cancel. •If the user clicks on OK button the window method confirm() will return true. If the user clicks on the Cancel button confirm() returns false. You can use confirmation dialog box confirm(“Message");
  • 4. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org DIALOG BOX •Prompt Dialog Box: •The prompt dialog box is very useful when you want to pop-up a text box to get user input. Thus it enable you to interact with the user. The user needs to fill in the field and then click OK. •This dialog box is displayed using a method called prompt() which takes two parameters (i) A label which you want to display in the text box (ii) A default string to display in the text box. •This dialog box with two buttons: OK and Cancel. If the user clicks on OK button the window method prompt() will return entered value from the text box. If the user clicks on the Cancel button the window method prompt() returns null. •prompt(“Message At top", “Name In Field");
  • 5. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org FUNCTIONS •A function is a group of reusable code which can be called anywhere in your program. This eliminates the need of writing same code again and again. •Help programmers to write modular code. •Can easily divide your big program in a number of small and manageable functions. •Like any other advance programming language, JavaScript also supports all the features necessary to write modular code using functions. •You must have seen functions like alert() and write(), We are using these function again and again but they have been written in core JavaScript only once.
  • 6. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org FUNCTIONS •The most common way to define a function in JavaScript is by using the function keyword, followed by a unique function name, a list of parameters (that might be empty), and a statement block surrounded by curly braces. •The basic syntax is shown here: function functionname(parameter-list) { statements } Calling a Function: •To invoke a function somewhere later in the script, you would simple need to write the name of that function as follows: functionname();
  • 7. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org FUNCTIONS Function Parameters: •There is a facility to pass different parameters while calling a function. •These passed parameters can be captured inside the function and any manipulation can be done over those parameters. •A function can take multiple parameters separated by comma. function functionname(para1,para2) { statements } The return Statement: A JavaScript function can have an optional return statement. This is required if you want to return a value from a function. This statement should be the last statement in a function.
  • 8. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org EVENTS IN JAVASCRIPT •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 an event. •When the user clicks a button, that click, too, is an event. • Another example of events are like: • pressing any key • closing window • resizing window. •Developers can use these events to execute JavaScript coded responses, which cause buttons to close windows, messages to be displayed to users, data to be validated, and virtually any other type of response imaginable to occur.
  • 9. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org HTML 4 STANDARD EVENTS Event Value Description onchange script Script runs when the element changes onsubmit script Script runs when the form is submitted onreset script Script runs when the form is reset onselect script Script runs when the element is selected onblur script Script runs when the element loses focus onfocus script Script runs when the element gets focus onkeydown script Script runs when key is pressed onkeypress script Script runs when key is pressed and released onkeyup script Script runs when key is released onclick script Script runs when a mouse click ondblclick script Script runs when a mouse double-click onmousedown script Script runs when mouse button is pressed onmousemove script Script runs when mouse pointer moves onmouseout script Script runs when mouse pointer moves out of an element onmouseover script Script runs when mouse pointer moves over an element onmouseup script Script runs when mouse button is released
  • 10. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org DOCUMENT OBJECT MODEL •Every web page resides inside a browser window which can be considered as an object. •A Document object represents the HTML document that is displayed in that window. •The Document object has various properties that refer to other objects which allow access to and modification of document content. •The way that document content is accessed and modified is called the Document Object Model, or DOM. The Objects are organized in a hierarchy. • This hierarchical structure applies to the organization of objects in a Web document. •Window object: Top of the hierarchy. It is the outmost element of the object hierarchy. •Document object: Each HTML document that gets loaded into a window becomes a document object. The document contains the content of the page. •Form object: Everything enclosed in the <form>...</form> tags sets the form object. •Form control elements: The form object contains all the elements defined for that object such as text fields, buttons, radio buttons, and checkboxes.
  • 11. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org
  • 12. © Copyright 2012 Hidaya Trust (Pakistan) â—Ź A Non-Profit Organization â—Ź www.hidayatrust.org / www,histpk.org