MVC Design Pattern in JavaScript by ADMEC Multimedia InstituteRavi Bhadauria
Â
This presentation is one of the best presentations from our study material for our JavaScript Object Oriented workshops which ADMEC conducts every week at the
center.
This presentation is a part of the COP2272C college level course taught at the Florida Polytechnic University located in Lakeland Florida. The purpose of this course is to introduce students to the C++ language and the fundamentals of object orientated programming..
The course is one semester in length and meets for 2 hours twice a week. The Instructor is Dr. Jim Anderson.
MVC Design Pattern in JavaScript by ADMEC Multimedia InstituteRavi Bhadauria
Â
This presentation is one of the best presentations from our study material for our JavaScript Object Oriented workshops which ADMEC conducts every week at the
center.
This presentation is a part of the COP2272C college level course taught at the Florida Polytechnic University located in Lakeland Florida. The purpose of this course is to introduce students to the C++ language and the fundamentals of object orientated programming..
The course is one semester in length and meets for 2 hours twice a week. The Instructor is Dr. Jim Anderson.
Visual basic asp.net programming introductionHock Leng PUAH
Â
After starting the project and generating the code behind file, we learn a little on
OOP (Object Oriented Programming)
Class and what a Class may contain
Inheritance
Namespace
Access Levels
Variables: valid and invalid variable naming
Data types: Integer, String, Boolean, Decimal
Decision making using IF âĻ ElseIf âĻ Else âĻ End If
Overview and about R, R Studio Installation, Fundamentals of R Programming: Data Structures and Data Types, Operators, Control Statements, Loop Statements, Functions,
Descriptive Analysis using R: Maximum, Minimum, Range, Mean, Median and Mode, Variance, Standard Deviation, Quantiles, IQR, Summary
ÕÕ ÕÕĄÕ´ÕĄÕĩÕļÖÕĢ ÔŋÕ¸Õ¸ÕēÕĨÖÕĄÕŋÕĢÕž | Credit Union for the IT IndustryStepan S. Khzrtian, Esq.
Â
ÕÖÕĨÕĻÕĨÕļÕŋÕĄÖÕĢÕĄÕļ ÕļÕĨÖÕ¯ÕĄÕĩÕĄÖÕļÕ¸ÖÕ´ Õ§ ÕžÕĄÖÕ¯ÕĄÕĩÕĢÕļ Õ´ÕĢÕĄÕžÕ¸ÖÕ´ÕĄÕļ (Credit Union) Õ°ÕĄÕŊÕ¯ÕĄÖÕ¸ÖÕŠÕĩÕ¸ÖÕļÕ¨, Õ´ÕĢÕģÕĄÕĻÕŖÕĄÕĩÕĢÕļ ÕĄÕŧÕĄÕģÕĄÕžÕ¸Ö ÖÕ¸ÖÕąÕ¨ Ö ÕĢÖÕĄÕŖÕ¸ÖÕŽÕĨÕŦÕĢÕ¸ÖÕŠÕĩÕ¸ÖÕļÕ¨ ÕÕĄÕĩÕĄÕŊÕŋÕĄÕļÕ¸ÖÕ´` ÕĄÕļÕ¤ÖÕĄÕ¤ÕĄÕŧÕļÕĄÕŦÕ¸Õž ÕļÕĄÖ Õ¯ÕĨÕļÕŊÕĄÕŠÕ¸ÕˇÕĄÕ¯ÕĄÕĩÕĢÕļ ÕžÕŗÕĄÖÕ¸ÖÕ´ÕļÕĨÖÕ¨ ÕÕ Õ¸ÕŦÕ¸ÖÕŋÕ¸ÖÕ´ ÕļÕĨÖÕ¤ÕļÕĨÕŦÕ¸Ö Õ°ÕļÕĄÖÕĄÕžÕ¸ÖÕ¸ÖÕŠÕĩÕ¸ÖÕļÕļÕĨÖÕĢÕļ: ÔąÕĩÕļ ÕļÕĨÖÕ¯ÕĄÕĩÕĄÖÕžÕĨÕŦ Õ§ 2016ÕŠ. ÖÕĨÕŋÖÕžÕĄÖÕĢ 27-28 Õ¯ÕĄÕĩÕĄÖÕĄÕŽ ÕÕÕ ÕĄÕŧÕĄÕģÕļÕ¸ÖÕ¤ÕļÕĨÖÕĢ Õ°ÕĄÕļÕ¤ÕĢÕēÕ´ÕĄÕļ Õ¨ÕļÕŠÕĄÖÖÕ¸ÖÕ´:
~
The presentation presents the concept of credit unions, international best practice, and legal feasibility in Armenia, also covering the possibilities of investing pension funds in the IT industry.
One notable advantage here is that viewers can choose to watch your presentation in full-screen format â a very useful feature if you have fine-detailed images or on-screen text you don't want your viewers to miss. You can even choose to sync the slideshow with an uploaded audio file to create an easy screencast. Comment and tag functions are included on the SlideShare site, so your organization might even benefit from the social networking aspect of the service.
But what if your organization would prefer to keep all your files on your own web space, rather than relying on a third-party service? No problem; there are several more options for getting PowerPoint onto the Web.
Visual basic asp.net programming introductionHock Leng PUAH
Â
After starting the project and generating the code behind file, we learn a little on
OOP (Object Oriented Programming)
Class and what a Class may contain
Inheritance
Namespace
Access Levels
Variables: valid and invalid variable naming
Data types: Integer, String, Boolean, Decimal
Decision making using IF âĻ ElseIf âĻ Else âĻ End If
Overview and about R, R Studio Installation, Fundamentals of R Programming: Data Structures and Data Types, Operators, Control Statements, Loop Statements, Functions,
Descriptive Analysis using R: Maximum, Minimum, Range, Mean, Median and Mode, Variance, Standard Deviation, Quantiles, IQR, Summary
ÕÕ ÕÕĄÕ´ÕĄÕĩÕļÖÕĢ ÔŋÕ¸Õ¸ÕēÕĨÖÕĄÕŋÕĢÕž | Credit Union for the IT IndustryStepan S. Khzrtian, Esq.
Â
ÕÖÕĨÕĻÕĨÕļÕŋÕĄÖÕĢÕĄÕļ ÕļÕĨÖÕ¯ÕĄÕĩÕĄÖÕļÕ¸ÖÕ´ Õ§ ÕžÕĄÖÕ¯ÕĄÕĩÕĢÕļ Õ´ÕĢÕĄÕžÕ¸ÖÕ´ÕĄÕļ (Credit Union) Õ°ÕĄÕŊÕ¯ÕĄÖÕ¸ÖÕŠÕĩÕ¸ÖÕļÕ¨, Õ´ÕĢÕģÕĄÕĻÕŖÕĄÕĩÕĢÕļ ÕĄÕŧÕĄÕģÕĄÕžÕ¸Ö ÖÕ¸ÖÕąÕ¨ Ö ÕĢÖÕĄÕŖÕ¸ÖÕŽÕĨÕŦÕĢÕ¸ÖÕŠÕĩÕ¸ÖÕļÕ¨ ÕÕĄÕĩÕĄÕŊÕŋÕĄÕļÕ¸ÖÕ´` ÕĄÕļÕ¤ÖÕĄÕ¤ÕĄÕŧÕļÕĄÕŦÕ¸Õž ÕļÕĄÖ Õ¯ÕĨÕļÕŊÕĄÕŠÕ¸ÕˇÕĄÕ¯ÕĄÕĩÕĢÕļ ÕžÕŗÕĄÖÕ¸ÖÕ´ÕļÕĨÖÕ¨ ÕÕ Õ¸ÕŦÕ¸ÖÕŋÕ¸ÖÕ´ ÕļÕĨÖÕ¤ÕļÕĨÕŦÕ¸Ö Õ°ÕļÕĄÖÕĄÕžÕ¸ÖÕ¸ÖÕŠÕĩÕ¸ÖÕļÕļÕĨÖÕĢÕļ: ÔąÕĩÕļ ÕļÕĨÖÕ¯ÕĄÕĩÕĄÖÕžÕĨÕŦ Õ§ 2016ÕŠ. ÖÕĨÕŋÖÕžÕĄÖÕĢ 27-28 Õ¯ÕĄÕĩÕĄÖÕĄÕŽ ÕÕÕ ÕĄÕŧÕĄÕģÕļÕ¸ÖÕ¤ÕļÕĨÖÕĢ Õ°ÕĄÕļÕ¤ÕĢÕēÕ´ÕĄÕļ Õ¨ÕļÕŠÕĄÖÖÕ¸ÖÕ´:
~
The presentation presents the concept of credit unions, international best practice, and legal feasibility in Armenia, also covering the possibilities of investing pension funds in the IT industry.
One notable advantage here is that viewers can choose to watch your presentation in full-screen format â a very useful feature if you have fine-detailed images or on-screen text you don't want your viewers to miss. You can even choose to sync the slideshow with an uploaded audio file to create an easy screencast. Comment and tag functions are included on the SlideShare site, so your organization might even benefit from the social networking aspect of the service.
But what if your organization would prefer to keep all your files on your own web space, rather than relying on a third-party service? No problem; there are several more options for getting PowerPoint onto the Web.
Safer Internet Armenia - Safe.am - Yerevan School 198
ÔąÕēÕĄÕ°Õ¸Õž ÕÕĄÕ´ÕĄÖÕĄÕļÖ ÕÕĄÕĩÕĄÕŊÕŋÕĄÕļ: ÔĩÖÖÕĄÕļÕĢ ÕŠ 198 Õ°ÕĢÕ´ÕļÕĄÕ¯ÕĄÕļ Õ¤ÕēÖÕ¸Ö: Ô´ÕĄÕŊÕ¨ Õ¯ÕĄÕĻÕ´ÕĄÕ¯ÕĨÖÕēÕĨÕŦ Ö ÕžÕĄÖÕĨÕŦ Õ§ ÔŧÕ¸ÖÕŊÕĢÕļÕĨ Ô˛ÕĄÕŦÕĄÕĩÕĄÕļÕ¨: ÔąÕžÕĨÕŦÕĢÕļ` http://safe.am Õ¯ÕĄÕĩÖÕ¸ÖÕ´:
Safer Internet Armenia. The open lesson in Internet Safety has been organised and moderated by Lusine Balayan. Find out more about Safer Internet Armenia at http://safe.am
Open Lesson dedicated to the topic of Internet Safety has been organised and moderated by Ani Torosyan at the Vanadzor Secondary School after Raffi N 19.
ÕÕĄÕļÕĄÕąÕ¸ÖÕĢ ÕÕĄÖÖÕ¸Ö ÕĄÕļÕžÕĄÕļ ÕŠ 19 Õ°ÕĢÕ´ÕļÕĄÕ¯ÕĄÕļ Õ¤ÕēÖÕ¸Ö: ÕÕĄÕ´ÕĄÖÕĄÕļÖÕĢ ÕĄÕēÕĄÕ°Õ¸Õž Ö ÕĄÕļÕžÕŋÕĄÕļÕŖ Ö ÕŖÕŋÕĄÕŖÕ¸ÖÕŽÕ´ÕĄÕļÕ¨ ÕļÕžÕĢÖÕžÕĄÕŽ ÕĸÕĄÖ Õ¤ÕĄÕŊÕ¨ Õ¯ÕĄÕĻÕ´ÕĄÕ¯ÕĨÖÕēÕĨÕŦ Ö ÕžÕĄÖÕĨÕŦ Õ§ ÔąÕļÕĢ ÔšÕ¸ÖÕ¸ÕŊÕĩÕĄÕļÕ¨:
Safer Internet Armenia - Safe.am - Yerevan School 154
ÔąÕēÕĄÕ°Õ¸Õž ÕÕĄÕ´ÕĄÖÕĄÕļÖ ÕÕĄÕĩÕĄÕŊÕŋÕĄÕļ: ÔĩÖÖÕĄÕļÕĢ ÕŠ 154 Õ°ÕĢÕ´ÕļÕĄÕ¯ÕĄÕļ Õ¤ÕēÖÕ¸Ö: Ô´ÕĄÕŊÕ¨ Õ¯ÕĄÕĻÕ´ÕĄÕ¯ÕĨÖÕēÕĨÕŦ Ö ÕžÕĄÖÕĨÕŦ Õ§ ÕÕĄÖÕĢÕļÕĄ ÕÕĄÖÕ¸ÖÕŠÕĩÕ¸ÖÕļÕĩÕĄÕļÕ¨: ÔąÕžÕĨÕŦÕĢÕļ` http://safe.am Õ¯ÕĄÕĩÖÕ¸ÖÕ´:
Safer Internet Armenia. The open lesson in Internet Safety has been organised and moderated by Marina Harutyunyan. Find out more about Safer Internet Armenia at http://safe.am
It is a JavaScript programming language e book which help you to boost up your Basic Concept and Help you to in hacking respect to Cross-Site Scripting Attack.
JavaScript is scripting/programming language. File Extension of JavaScript is ".jsâ. This extension can be catched by a number of applications including Windows Script Host, Dreamweaver MX, Notepad, Netscape Navigator, PavScrip, UltraEdit.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
Â
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasnât one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
Â
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as âdistorted thinkingâ.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
Â
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesarâs dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empireâs birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empireâs society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
Â
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
2. XP
2
Tutorial Objectives
ī¯ Understand basic JavaScript syntax
ī¯ Create an embedded and external script
ī¯ Work with variables and data
ī¯ Work with data objects and extract values
from dates
ī¯ Work with expressions and operators
ī¯ Create and call a JavaScript function
ī¯ Work with arrays and conditional statements
ī¯ Learn about program loops
3. XP
3
Server-Side Programs
ī¯ a user must be connected to the Web
server to run the server-side script
ī¯ only the programmer can create or alter
the script
ī¯ the system administrator has to be
concerned about users continually
accessing the server and potentially
overloading the system
4. XP
4
Client-Side Programs
ī¯ solve many of the problems associated with
server-side scripts
ī¯ can be tested locally without first uploading
it to a Web server
ī¯ are likely to be more responsive to the user
ī¯ can never completely replace server-side
scripts
5. XP
5
Introduction to JavaScript
ī¯ JavaScript is an interpreted programming or
script language from Netscape.
ī¯ JavaScript is used in Web site development to
such things as:
ī§ automatically change a formatted date on a
Web page
ī§ cause a linked-to-page to appear in a popup
window
ī§ cause text or a graphic image to change
during a mouse rollover
6. XP
6
Java vs. JavaScript
ī¯ Requires the JDK to
create the applet
ī¯ Requires a Java virtual
machine to run the applet
ī¯ Applet files are distinct
from the XHTML code
ī¯ Source code is hidden
from the user
ī¯ Programs must be saved
as separate files and
compiled before they can
be run
ī¯ Programs run on the
server side
ī¯ Requires a text editor
ī¯ Required a browser that
can interpret JavaScript
code
ī¯ JavaScript can be placed
within HTML and XHTML
ī¯ Source code is made
accessible to the user
ī¯ Programs cannot write
content to the hard disk
ī¯ Programs run on the
client side
7. XP
7
ECMAScript
ī¯ The responsibility for the development of a
scripting standard has been transferred to an
international body called the European
Computer Manufacturers Association (ECMA).
ī¯ The standard developed by the ECMA is
called ECMAScript, though browsers still refer
to it as JavaScript.
ī¯ The latest version is ECMA-262, which is
supported by the major browsers.
8. XP
8
Other Client-side Languages
ī¯ Internet Explorer supports JScript.
ī¯ JScript is identical to JavaScript, but there
are some JavaScript commands not
supported in JScript, and vice versa.
ī¯ Other client-side programming languages
are also available to Web page designers,
such as the Internet Explorer scripting
language, VBScript.
10. XP
10
Writing a JavaScript Program
ī¯ The Web browser runs a JavaScript program
when the Web page is first loaded, or in
response to an event.
ī¯ JavaScript programs can either be placed
directly into the HTML file or they can be saved
in external files.
īŽ placing a program in an external file allows
you to hide the program code from the user
īŽ source code placed directly in the HTML file
can be viewed by anyone
11. XP
11
Writing a JavaScript Program
ī¯ A JavaScript program can be placed anywhere
within the HTML file.
ī¯ Many programmers favor placing their
programs between <head> tags in order to
separate the programming code from the Web
page content and layout.
ī¯ Some programmers prefer placing programs
within the body of the Web page at the
location where the program output is
generated and displayed.
12. XP
12
Using the <script> Tag
ī¯ To embed a client-side script in a Web
page, use the element:
<script type=âtext/javascriptâ >
script commands and comments
</script>
ī¯ To access an external script, use:
<script src=âurlâ
type=âtext/javascriptâ>
script commands and comments
</script>
13. XP
13
Comments
ī¯ The syntax for a single-line comment is:
// comment text
ī¯ The syntax of a multi-line comment is:
/*
comment text covering several lines
*/
14. XP
14
Hiding Script from Older Browsers
ī¯ You can hide the script from these browsers
using comment tags:
<script type=âtext/javascriptâ>
<!-- Hide from non-JavaScript browsers
JavaScript commands
// Stop hiding from older browsers -->
</script>
ī¯ When a Web browser that doesnât support
scripts encounters this code, it ignores the
<script> tag.
15. XP
15
Writing Output to a Web Page
ī¯ JavaScript provides two methods to write text
to a Web page:
īŽ document.write(âtextâ);
īŽ document.writeln(âtextâ);
ī¯ The document.writeln() method differs from
document.write() in that it attaches a carriage
return to the end of each text string sent to the
Web page.
document.write("<h3>News Flash!</h3><br />");
16. XP
16
JavaScript Syntax Issues
ī¯ JavaScript commands and names are case-
sensitive.
ī¯ JavaScript command lines end with a
semicolon to separate it from the next
command line in the program.
īŽ in some situations, the semicolon is
optional
īŽ semicolons are useful to make your code
easier to follow and interpret
17. XP
17
Working with Variables & Data
ī¯ A variable is a named element in a program
that stores information. The following
restrictions apply to variable names:
īŽ the first character must be either a letter or
an underscore character ( _ )
īŽ the remaining characters can be letters,
numbers, or underscore characters
īŽ variable names cannot contain spaces
ī¯ Variable names are case-sensitive.
ī¯ document.write(Year);
18. XP
18
Types of Variables
JavaScript supports four different types of
variables:
īŽ numeric variables can be a number, such as
13, 22.5, or -3.14159
īŽ string variables is any group of characters,
such as âHelloâ or âHappy Holidays!â
īŽ Boolean variables are variables that accept one
of two values, either true or false
īŽ null variables is a variable that has no value at
all
19. XP
19
Declaring a Variable
ī¯ Before you can use a variable in your
program, you need to declare a variable
using the var command or by assigning the
variable a value.
ī¯ Any of the following commands is a
legitimate way of creating a variable named
âMonthâ:
var Month;
var Month = âDecemberâ;
Month = âDecemberâ;
20. XP
20
Working with Dates
ī¯ There are two ways to create a date object:
variable = new Date(âmonth day, year,
hours:minutes: secondsâ)
variable = new Date(year, month, day, hours,
minutes, secondsâ)
īŽ variable is the name of the variable that
contains the date information
īŽ month, day, year, hours, minutes, and
seconds indicate the date and time
var Today=new Date(âOctober 15, 2006â);
var Today=new Date(2006, 9, 15);
21. XP
21
Retrieving the Day & Time Values
ī¯ JavaScript stores dates and times as the
number of milliseconds since 6 p.m on
12/31/69.
ī¯ Use built in JavaScript date methods to do
calculations.
ī¯ If you want the ThisDay variable to store the
day of the month. To get that information,
apply the getDate() method.
DayValue = DateObject.getDate()
22. XP
22
Retrieving the Month Value
ī¯ The getMonth() method extracts the
value of the current month.
ī¯ JavaScript starts counting months with 0
for January, you may want to add 1 to the
month number returned by the getMonth()
method.
ī¯ ThisMonth = Today.getMonth()+1;
23. XP
23
Retrieving the Year Value
ī¯ The getFullYear() method extracts the
year value from the date variable.
ī¯ ThisYear = Today.getFullYear();
24. XP
24
Working with Expressions
and Operators
ī¯ Expressions are JavaScript commands that
assign values to variables.
ī¯ Expressions are created using variables,
values, and operators.
ī¯ The + operator performs the action of
adding or combining two elements. For
example,
īŽ var ThisMonth = Today.getMonth()+1;
25.
26. XP
26
Operators
ī¯ Binary operators work on two elements in an
expression.
ī¯ Unary operators work on only one variable.
īŽ unary operators include: the increment (+
+), decrement (--), and negation (-)
operators.
ī¯ An increment operator is used to increase the
value of the x variable by one.
x = 100;
y = x++;
27. XP
27
Operators
ī¯ The decrement operator reduces the value
of a variable by 1.
x = 100;
y = x--;
ī¯ The negation operator changes the sign of
a variable:
x = -100;
y = -x;
28. XP
28
Assignment Operators
ī¯ Expressions assign values using assignment
operators. â=â is the most common one.
ī¯ Additional includes the += operator
ī¯ The following create the same results:
x = x + y;
x += y
ī¯ Either of the following increase the value of
the x variable by 2:
x = x + 2;
x += 2
30. XP
30
The Math Object & Math
Methods
ī¯ Another way of performing a calculation is to
use the JavaScript built-in Math methods.
ī¯ These methods are applied to an object called
the Math object.
ī¯ The syntax for applying a Math method is:
value = Math.method(variable);
ī¯ For example,
AbsValue = Math.abs(NumVar);
31.
32. XP
32
Creating JavaScript Functions
function function_name(parameters) {
JavaScript commands
}
īŽ parameters are the values sent to the
function (note: not all functions require
parameters)
īŽ { and } are used to mark the beginning and
end of the commands in the function.
33. XP
33
Creating JavaScript Functions
ī¯ Function names are case-sensitive.
ī¯ The function name must begin with a letter or
underscore ( _ ) and cannot contain any
spaces.
ī¯ There is no limit to the number of function
parameters that a function may contain.
ī¯ The parameters must be placed within
parentheses, following the function name, and
the parameters must be separated by
commas.
34. XP
34
Performing an Action with a
Function
The following function displays a message with the
current date:
function ShowDate(date) {
document.write(âToday isâ + date + â<br>â);
}
īŽ there is one line in the functionâs command
block, which displays the current date along
with a text string
35. XP
35
Performing an Action with a
Function
To call the ShowDate function, enter:
var Today = â3/9/2006â;
ShowDate(Today);
īŽ the first command creates a variable named
âTodayâ and assigns it the text string,
â3/9/2006â
īŽ the second command runs the ShowDate
function, using the value of the Today variable
as a parameter
īŽ result is âToday is 3/9/2006â
36. XP
36
Returning a Value from a
Function
To use a function to calculate a value use the
return command along with a variable or value.
function Area(Width, Length) {
var Size = Width*Length;
return Size;
}
īŽ the Area function calculates the area of a
rectangular region and places the value in a
variable named âSizeâ
īŽ the value of the Size variable is returned by
the function
37. XP
37
Placing a Function
in an HTML File
ī¯ The function definition must be placed
before the command that calls the function.
ī¯ One convention is to place all of the
function definitions in the <head> section.
ī¯ A function is executed only when called by
another JavaScript command.
ī¯ Itâs common practice for JavaScript
programmers to create libraries of functions
located in external files.
39. <head>
<script src="library.js" type="text/javascript">
</script>
</head>
<script type="text/javascript">
var Today=new Date("October 15, 2006");
var ThisDay=Today.getDate();
var ThisMonth=Today.getMonth()+1;
var ThisYear=Today.getFullYear();
var DaysLeft=XmasDays(Today);
</script>
document.write("Today is "+ThisMonth+"/"+
ThisDay+"/"+ThisYear+"<br />");
document.write("Only "+DaysLeft+
" days until Christmas");
40. function XmasDays(CheckDay) {
var XYear=CheckDay.getFullYear();
var XDay=new Date("December, 25, 2006");
XDay.setFullYear(XYear);
var DayCount=(XDay-CheckDay) /(1000*60*60*24);
DayCount=Math.round(DayCount);
return DayCount;
}
library.js
42. XP
42
Working with Conditional
Statements
if (condition) {
JavaScript Commands
}
īŽ condition is an expression that is either true
or false
īŽ if the condition is true, the JavaScript
Commands in the command block are
executed
īŽ if the condition is not true, then no action is
taken
43. XP
43
Comparison, Logical, and
Conditional Operators
To create a condition, you need one of three types
of operators:
īŽ a comparison operator compares the value
of one element with that of another, which
creates a Boolean expression that is either
true or false
īŽ a logical operator connects two or more
Boolean expressions
īŽ a conditional operator tests whether a
specific condition is true and returns one value
if the condition is true and a different value if
the condition is false
44. XP
44
An Example of
Boolean Expressions
ī¯ x < 100;
īŽ if x is less than 100, this expression returns
the value true; however, if x is 100 or
greater, the expression is false
ī¯ y == 20;
īŽ the y variable must have an exact value of
20 for the expression to be true
īŽ comparison operator uses a double equal
sign (==)
46. XP
46
A Logical Operator
ī¯ The logical operator && returns a value of true
only if all of the Boolean expressions are true.
47. XP
47
A Conditional Operator
tests whether a specific condition is true and
returns one value if the condition is true and a
different value if the condition is false.
īŽ Message = (mail == âYesâ) ? âYou have
mailâ: âNo mailâ;
īŽ tests whether the mail variable is equal to the
value âYesâ
ī¯ if it is, the Message variable has the value
âYou have mailâ;
ī¯ otherwise, the Message variable has the
value âNo mailâ.
48. XP
48
Using an If...Else Statement
if (condition) {
JavaScript Commands if true
} else
JavaScript Commands if false
}
īŽ condition is an expression that is either true
or false, and one set of commands is run if
the expression is true, and another is run if
the expression is false
49. document.write("Today is " + ThisMonth +
"/â+ThisDay+"/"+ThisYear+"<br />");
if (DaysLeft > 0) {
document.write("Only "+DaysLeft+
" days until Christmas");
} else {
document.write("Happy Holidays from
Nroth Pole Novelties");
}
if...else Conditional Statement
50. XP
50
Using Arrays
ī¯ An array is an ordered collection of values
referenced by a single variable name.
ī¯ The syntax for creating an array variable is:
var variable = new Array(size);
īŽ variable is the name of the array variable
īŽ size is the number of elements in the array
(optional)
ī¯ To populate the array with values, use:
variable[i]=value;
where i is the ith
item of the array. The 1st
item
has an index value of 0.
51. XP
51
Using Arrays
To create and populate the array in a single
statement, use:
var variable = new Array(values);
īŽ values are the array elements enclosed in
quotes and separated by commas
īŽ var MonthTxt=new Array(ââ, âJanuaryâ,
âFebruaryâ, âMarchâ, âAprilâ, âMayâ, âJuneâ,
âJulyâ, âAugustâ, âSeptemberâ, âOctoberâ,
âNovemberâ, âDecemberâ);
ī¯ January will have an index value of â1â.
52. <script type="text/javascript">
var Today=new Date();
var ThisDay=Today.getDate();
var ThisMonth=Today.getMonth()+1;
var ThisYear=Today.getFullYear();
var DaysLeft=XmasDays(Today);
var MonthTxt = new Array("", "January", "February", "March",
"April", "May", "June", "July", "August", "September",
"October","November", "December");
document.write("Today is "+MonthTxt[ThisMonth]+" " +
ThisDay+", "+ThisYear+"<br />");
if (DaysLeft > 0) {
document.write("Only "+DaysLeft+" days until Christmas");
} else {
document.write("Happy Holidays from North Pole
Novelties");
}
</script>
53. function MonthTxt(MonthNumber) {
var Month=new Array();
Month[0]="";
Month[1]="January";
Month[2]="February";
Month[3]="March";
Month[4]="April";
Month[5]="May";
Month[6]="June";
Month[7]="July";
Month[8]="August";
Month[9]="September";
Month[10]="October";
Month[11]="November";
Month[12]="December";
return Month[MonthNumber];
}
Creating the MonthText Function in library2.js
55. XP
55
Working with Program Loops
ī¯ A program loop is a set of instructions
that is executed repeatedly.
ī¯ There are two types of loops:
īŽ loops that repeat a set number of
times before quitting
īŽ loops that repeat as long as a certain
condition is met
56. XP
56
The For Loop
ī¯ The For loop allows you to create a group of
commands to be executed a set number of
times through the use of a counter that tracks
the number of times the command block has
been run.
ī¯ Set an initial value for the counter, and each
time the command block is executed, the
counter changes in value.
ī¯ When the counter reaches a value above or
below a certain stopping value, the loop ends.
57. XP
57
The For Loop Continued
for (start; condition; update) {
JavaScript Commands
}
īŽ start is the starting value of the counter
īŽ condition is a Boolean expression that must
be true for the loop to continue
īŽ update specifies how the counter changes in
value each time the command block is
executed
61. XP
61
The While Loop
ī¯ The While loop runs a command group as
long as a specific condition is met, but it does
not employ any counters.
ī¯ The general syntax of the While loop is:
while (condition) {
JavaScript Commands
}
īŽ condition is a Boolean expression that can
be either true or false