SlideShare a Scribd company logo
JavaScript
Intro to scripting languages
Goals
 Understand structure of JavaScript
 Understand rules of coding
 Add active content to WebPages
 Add functions to WebPages
JavaScript
 Programming language to add
interactive content to pages
 Validate forms
 Utilize cookies
 Control browser functions
 Inform users
JavaScript
 Script should be placed in the <head>
section of the page
 JS is not HTML, you will need to make
the browser aware of the code by
using <script> tag
 <script type="text/javascript"> and
</script>
JavaScript
 Rules
 End each line with a semicolon ;
 Text must be enclosed in quotes “ “
 JS is case sensitive
 Upper and lower case letters are NOT the
same
 JS is incredibly sensitive to mistakes,
be extremely cautious!
JavaScript
 <script>
document.write("Welcome to my
world!!!");
</script>
 This will write Welcome to my world!!!
In your page
 Not so exciting, but this can be used to
write code to your page, creating
massive pages with little coding
JavaScript
 JS uses variables in order to store
data and execute code
 JS is case sensitive
 Upper case and lower case are seen
differently
 Myvariable <> myvariable
<>MyVariable
 Use same syntax throughout
JavaScript
 Popup boxes
 Not popup windows, that is a breach of
netiquette
 Alert
 Confirm
 Prompt
JavaScript
 Alert
 Used to inform user of something
important
 Confirm
 Used to confirm information, typically to
redirect user to acceptable page
 Prompt
 Used to gain information from user for
use in document
JavaScript
 Alert
 Alert(“text goes here”)
 Confirm
 Confirm(“text goes here”)
 Prompt
 Prompt(“text goes here”, “default value”)
JavaScript
 Confirms are typically written as if
statements
 If statements are standard programming
when a choice needs to be made
 If OK is selected TRUE is registered
 If CANCEL is selected FALSE is
registered
 Prompt boxes are typically used to
store information in a variable
JavaScript
 Variable
 Place to store information for later use
 Example
 Username=prompt(“Enter Name”,
“Name”);
 Document.write(“Welcome” +username
+“!”);
 2nd example
 name=“my first name”;
 myname=tom;
 Document.write(myname);
JavaScript
 Use the equal sign (=) to assign a
value to a variable
 Variable can be used for input, output
and mathematical operations
 To compare variable, use a double
equal sign (==)
JavaScript
 Other comparing operators
!= Not equal
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
JavaScript
 If statements
 if (condition) {action1} else {action2}
 Example
 if (confirm("Are you home?")) {alert("Welcome
Home")}
 else{alert("Go Away!")};
 If statements can also be “nested”
 if (confirm("Are you home?")) {alert("Welcome
Home")}
 else{if (confirm("Do you want to come in?"))
{alert("Welcome to your new home!")}
 else{alert("Go Away!")};};
JavaScript
 Logical Operators
 AND ( && )
 Both conditions must be true
 if (condition && condition) {action}
 OR ( || )
 Either condition must be true
 if (condition || condition) {action}
 NOT ( ! )
 Inverts result of condition
 if (!(condition)) {action}
JavaScript
 Functions
 Pre-set event that allows a script action to take
place on or after specific event
 JS events will happen as soon as the page
loads unless written in a function
 function myfunction()
 { alert(“Welcome Home!”);}
 Later in the page
 <form name=“myform”>
 <input type=“button” value=“Press Once”
 onclick=“myfunction()”>
 </form>
JavaScript
 General form
 function functionname(variable1,
variable2…)
 {
 JS for actual function;
 }
JavaScript
 Events
 JS actions are referred to as events
JavaScript
 onmouseover and onmouseout can be
used in animating buttons
 Can only be used in conjunction with <a>
tags
 Idea for use
 Create simple images (buttons, arrows,
words) for links
 onclick will cause an action to happen
with user action
JavaScript
 Animated Buttons
 Two steps
 onmouseover
 onmouseout
 Animation can only be applied to links
JavaScript
 Loops
 Causes an action to happen a pre-
determined amount of times
 Two types
 For
 While
JavaScript
 For
 Used when you know exactly how many
times an action should happen
 While
 Used to do an action until some
requirement is met
JavaScript
 For
 for (variable=startvalue;
variable<=endvalue;
variable=variable+incrementfactor)
{
JS goes here
}
 Helpful for writing large HTML tables that
require user input
 Idea: prompt box to define variable, for to give
specific range of data
JavaScript
 While
 while (variable<=endvalue)
{
JS goes here
}
 Also helpful for large tables, better
suited when user input is not needed
JavaScript
 Break
 Stops a loop at a specific point
 if (value==0) {break};
 Continue
 A skip in a loop
 for (value=-50; value<=50;
value=value+1)
{
if (value==0) {continue};
document.write((100/value)+"<br>");
}
JavaScript
 Array
 Automatically define large amount of
variables
Value1=10
Value2=20
Value3=30
….
Value1000=10000
value=new Array;
for (number=1;
number<=100;
number=number+1)
{
value[number]=number*
10};
JavaScript
 The name of the array, new Array, is
critical
 Array must be capitalized

More Related Content

Similar to 1472251766_demojavascriptppt (1).ppt

wp-UNIT_III.pptx
wp-UNIT_III.pptxwp-UNIT_III.pptx
wp-UNIT_III.pptx
GANDHAMKUMAR2
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
nanjil1984
 
Java scripts
Java scriptsJava scripts
Java scripts
Capgemini India
 
Java scipt
Java sciptJava scipt
Introduction of javascript
Introduction of javascriptIntroduction of javascript
Introduction of javascript
syeda zoya mehdi
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
Rajiv Gupta
 
Javascript
JavascriptJavascript
Javascript
D V BHASKAR REDDY
 
JavaScript with Syntax & Implementation
JavaScript with Syntax & ImplementationJavaScript with Syntax & Implementation
JavaScript with Syntax & Implementation
Soumen Santra
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
dominion
 
JavaScript
JavaScriptJavaScript
JavaScript
Rowena LI
 
Java script
Java scriptJava script
Java script
Jay Patel
 
Javascript
JavascriptJavascript
Javascript
Nagarajan
 
Intro to java script
Intro to java scriptIntro to java script
Intro to java script
londiem
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
Hassan Ahmed Baig - Web Developer
 
Javascript1
Javascript1Javascript1
Javascript1
anas Mohtaseb
 
Basic Java script handouts for students
Basic Java script handouts for students Basic Java script handouts for students
Basic Java script handouts for students
shafiq sangi
 
Javascript sivasoft
Javascript sivasoftJavascript sivasoft
Javascript sivasoft
ch samaram
 
Java script basics
Java script basicsJava script basics
Java script basics
John Smith
 
BITM3730 10-17.pptx
BITM3730 10-17.pptxBITM3730 10-17.pptx
BITM3730 10-17.pptx
MattMarino13
 
Introduction to Javascript programming
Introduction to Javascript programmingIntroduction to Javascript programming
Introduction to Javascript programming
Fulvio Corno
 

Similar to 1472251766_demojavascriptppt (1).ppt (20)

wp-UNIT_III.pptx
wp-UNIT_III.pptxwp-UNIT_III.pptx
wp-UNIT_III.pptx
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
 
Java scripts
Java scriptsJava scripts
Java scripts
 
Java scipt
Java sciptJava scipt
Java scipt
 
Introduction of javascript
Introduction of javascriptIntroduction of javascript
Introduction of javascript
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript with Syntax & Implementation
JavaScript with Syntax & ImplementationJavaScript with Syntax & Implementation
JavaScript with Syntax & Implementation
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Java script
Java scriptJava script
Java script
 
Javascript
JavascriptJavascript
Javascript
 
Intro to java script
Intro to java scriptIntro to java script
Intro to java script
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
 
Javascript1
Javascript1Javascript1
Javascript1
 
Basic Java script handouts for students
Basic Java script handouts for students Basic Java script handouts for students
Basic Java script handouts for students
 
Javascript sivasoft
Javascript sivasoftJavascript sivasoft
Javascript sivasoft
 
Java script basics
Java script basicsJava script basics
Java script basics
 
BITM3730 10-17.pptx
BITM3730 10-17.pptxBITM3730 10-17.pptx
BITM3730 10-17.pptx
 
Introduction to Javascript programming
Introduction to Javascript programmingIntroduction to Javascript programming
Introduction to Javascript programming
 

Recently uploaded

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 

Recently uploaded (20)

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 

1472251766_demojavascriptppt (1).ppt

  • 2. Goals  Understand structure of JavaScript  Understand rules of coding  Add active content to WebPages  Add functions to WebPages
  • 3. JavaScript  Programming language to add interactive content to pages  Validate forms  Utilize cookies  Control browser functions  Inform users
  • 4. JavaScript  Script should be placed in the <head> section of the page  JS is not HTML, you will need to make the browser aware of the code by using <script> tag  <script type="text/javascript"> and </script>
  • 5. JavaScript  Rules  End each line with a semicolon ;  Text must be enclosed in quotes “ “  JS is case sensitive  Upper and lower case letters are NOT the same  JS is incredibly sensitive to mistakes, be extremely cautious!
  • 6. JavaScript  <script> document.write("Welcome to my world!!!"); </script>  This will write Welcome to my world!!! In your page  Not so exciting, but this can be used to write code to your page, creating massive pages with little coding
  • 7. JavaScript  JS uses variables in order to store data and execute code  JS is case sensitive  Upper case and lower case are seen differently  Myvariable <> myvariable <>MyVariable  Use same syntax throughout
  • 8. JavaScript  Popup boxes  Not popup windows, that is a breach of netiquette  Alert  Confirm  Prompt
  • 9. JavaScript  Alert  Used to inform user of something important  Confirm  Used to confirm information, typically to redirect user to acceptable page  Prompt  Used to gain information from user for use in document
  • 10. JavaScript  Alert  Alert(“text goes here”)  Confirm  Confirm(“text goes here”)  Prompt  Prompt(“text goes here”, “default value”)
  • 11. JavaScript  Confirms are typically written as if statements  If statements are standard programming when a choice needs to be made  If OK is selected TRUE is registered  If CANCEL is selected FALSE is registered  Prompt boxes are typically used to store information in a variable
  • 12. JavaScript  Variable  Place to store information for later use  Example  Username=prompt(“Enter Name”, “Name”);  Document.write(“Welcome” +username +“!”);  2nd example  name=“my first name”;  myname=tom;  Document.write(myname);
  • 13. JavaScript  Use the equal sign (=) to assign a value to a variable  Variable can be used for input, output and mathematical operations  To compare variable, use a double equal sign (==)
  • 14. JavaScript  Other comparing operators != Not equal < Less than > Greater than <= Less than or equal to >= Greater than or equal to
  • 15. JavaScript  If statements  if (condition) {action1} else {action2}  Example  if (confirm("Are you home?")) {alert("Welcome Home")}  else{alert("Go Away!")};  If statements can also be “nested”  if (confirm("Are you home?")) {alert("Welcome Home")}  else{if (confirm("Do you want to come in?")) {alert("Welcome to your new home!")}  else{alert("Go Away!")};};
  • 16. JavaScript  Logical Operators  AND ( && )  Both conditions must be true  if (condition && condition) {action}  OR ( || )  Either condition must be true  if (condition || condition) {action}  NOT ( ! )  Inverts result of condition  if (!(condition)) {action}
  • 17. JavaScript  Functions  Pre-set event that allows a script action to take place on or after specific event  JS events will happen as soon as the page loads unless written in a function  function myfunction()  { alert(“Welcome Home!”);}  Later in the page  <form name=“myform”>  <input type=“button” value=“Press Once”  onclick=“myfunction()”>  </form>
  • 18. JavaScript  General form  function functionname(variable1, variable2…)  {  JS for actual function;  }
  • 19. JavaScript  Events  JS actions are referred to as events
  • 20. JavaScript  onmouseover and onmouseout can be used in animating buttons  Can only be used in conjunction with <a> tags  Idea for use  Create simple images (buttons, arrows, words) for links  onclick will cause an action to happen with user action
  • 21. JavaScript  Animated Buttons  Two steps  onmouseover  onmouseout  Animation can only be applied to links
  • 22. JavaScript  Loops  Causes an action to happen a pre- determined amount of times  Two types  For  While
  • 23. JavaScript  For  Used when you know exactly how many times an action should happen  While  Used to do an action until some requirement is met
  • 24. JavaScript  For  for (variable=startvalue; variable<=endvalue; variable=variable+incrementfactor) { JS goes here }  Helpful for writing large HTML tables that require user input  Idea: prompt box to define variable, for to give specific range of data
  • 25. JavaScript  While  while (variable<=endvalue) { JS goes here }  Also helpful for large tables, better suited when user input is not needed
  • 26. JavaScript  Break  Stops a loop at a specific point  if (value==0) {break};  Continue  A skip in a loop  for (value=-50; value<=50; value=value+1) { if (value==0) {continue}; document.write((100/value)+"<br>"); }
  • 27. JavaScript  Array  Automatically define large amount of variables Value1=10 Value2=20 Value3=30 …. Value1000=10000 value=new Array; for (number=1; number<=100; number=number+1) { value[number]=number* 10};
  • 28. JavaScript  The name of the array, new Array, is critical  Array must be capitalized