Java Script Lecture 5 - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Java Script Lecture 5

Description:

alert('This appears only when the function is called'); alert('this shall appear anyways' ... alert('this shall appear anyways'); add(); body /body /html ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 9
Provided by: remusR
Category:
Tags: anyways | java | lecture | script

less

Transcript and Presenter's Notes

Title: Java Script Lecture 5


1
Java Script Lecture 5
  • -- last assignment (use free late)
  • -- this weeks assignment
  • -- review chapter 18
  • -- functions

2
Function Packages for algorithms
  • Name
  • Parameters
  • Definition
  • Also known as,
  • procedures, subroutine, method etc

3
  • function name (parameter list)
  • statement list

4
  • function print ()
  • document.write(hello)

5
  • lthtmlgt
  • ltheadgt
  • ltscript type"text/javascript"gt
  • function hello()
  • document.write("ltbrgt hello")
  • document.write ("outside the function")
  • hello()
  • lt/scriptgt
  • lt/headgt
  • ltbodygtlt/bodygt
  • lt/htmlgt

6
lthtmlgt ltheadgt ltscript type"text/javascript"gt
function displaymessage() alert("This
appears only when the function is
called") alert("this shall appear
anyways") lt/scriptgt lt/headgt
ltbodygt ltscript
type"text/javascript"gt
displaymessage() lt/scriptgt
lt/bodygt lt/htmlgt
7
  • lthtmlgt
  • ltheadgt
  • ltscript type"text/javascript"gt
  • var text1 hello inside function
  • var text2 hello outside function
  • function passarg(text1)
  • alert(text1)
  • alert(text2)
  • lt/scriptgt
  • lt/headgt
  • ltbodygtlt/bodygt
  • lt/htmlgt

8
  • lthtmlgt
  • ltheadgtlttitlegtfunction addlt/titlegt
  • ltscript type"text/javascript"gt
  • function add(a,b)
  • c ab
  • return c
  • alert("this shall appear anyways")
  • add()
  • ltbodygt lt/bodygt
  • lt/htmlgt
Write a Comment
User Comments (0)
About PowerShow.com