SlideShare a Scribd company logo
JAVASCRIPT POPUP BOXES
Zakho Technical Institute
IT Dept.
16-Feb.-2015
JAVASCRIPT POPUP BOXES
 There are three message boxes:
alert, confirm, and prompt. Let's look at the
first one:
ALERT
 An alert box is often used if you want to make sure
information comes through to the user.
 When an alert box pops up, the user will have to click
"OK" to proceed.
 <body>
 <script>
 alert("Welcome to my site!")
 </script>
 </body>
You can put whatever you want inside the quotation marks.
CONFIRM
 <body>
 <script>
 confirm("Are you sure you want to quit?")
 </script>
 </body>
PROMPT
 Prompt box is used to allow a user to enter
something according the promotion:
EXAMPLE
 <script>
 var x=confirm("Are you sure you want to
quit")
 if (x)
 alert("Thank you.")
 else
 alert("Good choice.")
 </script>
EXAMPLE
 <html><head> <script>
 var x=confirm("Are you sure you want to
quit?")
 if (!x)
 location="http://www.yahoo.com"
</script></head>
 <body> Welcome to my website!.
 </body></html>If you click "cancel", it will take you to yahoo, and clicking ok will continue with the loading
of the current page "Welcome to my website!". Note:if (!x)means: if click "cancel". In
JavaScript, the exclamation mark ! means: "none".
EVENT HANDLER
 What are event handlers?
They can be considered as triggers that
execute JavaScript when something
happens, such as click or move your mouse
over a link, submit a form etc.
 onClick
onClick handlers execute something only when
users click on buttons, links, etc. Let's see an
example:
 <script>
 function ss()
 { alert("Thank you!") }
 </script>
 <form>
 <input type="button" value="Click here"
onclick="ss()">
 </form>
The function ss() is invoked when the user clicks the button. Note: Event
handlers are not added inside the<script> tags, but rather, inside the html
tags.
JAVASCRIPT SPECIAL CHARACTERS
 In JavaScript you can add special characters to a
text string byInsert Special Characters
 The backslash () is used to insert apostrophes,
new lines, quotes, and other special characters
into a text string.
 Look at the following JavaScript code:
 using the backslash sign.
EXAMPLE
 var txt="We are the so-called "Vikings" from
the north.";
document.write(txt);
 In JavaScript, a string is started and stopped
with either single or double quotes. This means
that the string above will be chopped to:
We are the so-called
 To solve this problem, you must place a
backslash () before each double quote in
"Viking". This turns each double quote into a
string literal:
EXAMPLE
 var txt="We are the so-called "Vikings" from
the north.";
document.write(txt);
 JavaScript will now output the proper text
string: We are the so-called "Vikings" from
the north.
 The table below lists other special characters
that can be added to a text string with the
backslash sign:
TABLE
BREAK UP LINE
 document.write("Hello World!");
 or
 document.write ("Hello World!");
 which is right ...?
ARRAY
 Create an Array
 An array can be defined in three ways.
 The following code creates an Array object
called myCars:
 var myCars=new Array(); // regular array (add
an optional integer
myCars[0]="Saab"; // argument to control
array's size)
myCars[1]="Volvo";
myCars[2]="BMW";
ARRAY
 var myCars=new
Array("Saab","Volvo","BMW"); // condensed
array
 var myCars=["Saab","Volvo","BMW"]; // literal
array
ACCESS AN ARRAY
 You can refer to a particular element in an
array by referring to the name of the array
and the index number. The index number
starts at 0.
 The following code line:
 Document.write(myCars[0]);
 will result in the following output:
 Saab
EXAMPLE
 Create an array for Web shoppe contains 5
element:
 customer's name
 customer's date of birth
 customer's address
 customer's phone number
 total bill amount
THAT’S IT ...
?
☺
Yes No
QUESTIONS GAME .....
 Choose ur favourite no.
1
2
15
3
4
5
6
7
8
9
10
12
16
14
12
13
1
11
1
 True or false :
 JS is usually embedded directly into html
pages ................
2
 How can u write a comments in JS ....?
3
 The “radio” element used for selecting one of
many choice ....>>>>> T or F ......
4
 The <txet area> defines a multiline input field
(a text area)..
T or F
5
 The “checkbox” is the same as
“radiobutton”...
 T or F
6
 In CSS .... Border clear an area around
the contents ..
 T or F .. Correct if F
7
 What is the full word of HTML .....?
8
 JS is sensitive for letter ....isn’t it ?explain
9
 Define .......
“World Wide Web”
10
 Http mean” Hyper ......... ........ ........”
11
 Can you clarify the meaning of “URL” ..?
12
 What is CSS ?
13
 Clarify with example the syntax of CSS ...
14
 The id selector is defined with “{“ ...
 T or F
15
 What are event handlers?
16
 How many message boxes did we have in
JS ?
 Explain with examples......
Message Box in JS

More Related Content

What's hot

Java script basic
Java script basicJava script basic
Java script basic
Ravi Bhadauria
 
Javascript validating form
Javascript validating formJavascript validating form
Javascript validating form
Jesus Obenita Jr.
 
HTML Forms Tutorial
HTML Forms TutorialHTML Forms Tutorial
HTML Forms Tutorial
ProdigyView
 
html forms
html formshtml forms
html forms
ikram niaz
 
Form validation server side
Form validation server side Form validation server side
Form validation server side
Mudasir Syed
 
Creating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchCreating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off Switch
Russ Weakley
 
Html forms
Html formsHtml forms
Html forms
nobel mujuji
 
phptut2
phptut2phptut2
phptut2
tutorialsruby
 
Creating an Accessible button dropdown
Creating an Accessible button dropdownCreating an Accessible button dropdown
Creating an Accessible button dropdown
Russ Weakley
 
2. HTML forms
2. HTML forms2. HTML forms
2. HTML forms
Pavle Đorđević
 
05 html-forms
05 html-forms05 html-forms
05 html-forms
Palakshya
 
Web application security
Web application securityWeb application security
Web application security
salissal
 

What's hot (12)

Java script basic
Java script basicJava script basic
Java script basic
 
Javascript validating form
Javascript validating formJavascript validating form
Javascript validating form
 
HTML Forms Tutorial
HTML Forms TutorialHTML Forms Tutorial
HTML Forms Tutorial
 
html forms
html formshtml forms
html forms
 
Form validation server side
Form validation server side Form validation server side
Form validation server side
 
Creating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchCreating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off Switch
 
Html forms
Html formsHtml forms
Html forms
 
phptut2
phptut2phptut2
phptut2
 
Creating an Accessible button dropdown
Creating an Accessible button dropdownCreating an Accessible button dropdown
Creating an Accessible button dropdown
 
2. HTML forms
2. HTML forms2. HTML forms
2. HTML forms
 
05 html-forms
05 html-forms05 html-forms
05 html-forms
 
Web application security
Web application securityWeb application security
Web application security
 

Similar to Message Box in JS

FSJavaScript.ppt
FSJavaScript.pptFSJavaScript.ppt
FSJavaScript.ppt
AbhishekKumar66407
 
Javascript
JavascriptJavascript
Javascript
D V BHASKAR REDDY
 
Java script basics
Java script basicsJava script basics
Java script basics
John Smith
 
Web programming
Web programmingWeb programming
Web programming
Leo Mark Villar
 
Unit 2.4
Unit 2.4Unit 2.4
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
Chris x-MS
 
Unit 2.4
Unit 2.4Unit 2.4
Javascript part1
Javascript part1Javascript part1
Javascript part1
Raghu nath
 
Java script
Java scriptJava script
Java script
Jay Patel
 
FYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptFYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III Javascript
Arti Parab Academics
 
wp-UNIT_III.pptx
wp-UNIT_III.pptxwp-UNIT_III.pptx
wp-UNIT_III.pptx
GANDHAMKUMAR2
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
Rajiv Gupta
 
Web designing unit 4
Web designing unit 4Web designing unit 4
Web designing unit 4
SURBHI SAROHA
 
Java scripts
Java scriptsJava scripts
Java scripts
Capgemini India
 
Popup boxes
Popup boxesPopup boxes
Popup boxes
sonal bisla
 
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atlGutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
Glenn Gutmacher
 
Java script
 Java script Java script
Java script
bosybosy
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
Mindy McAdams
 
13-IntroJavascript.pptxIntroduction to java script
13-IntroJavascript.pptxIntroduction to java script13-IntroJavascript.pptxIntroduction to java script
13-IntroJavascript.pptxIntroduction to java script
gdckviksitbharat
 
13-IntroJavascript.pptx
13-IntroJavascript.pptx13-IntroJavascript.pptx
13-IntroJavascript.pptx
suchita74
 

Similar to Message Box in JS (20)

FSJavaScript.ppt
FSJavaScript.pptFSJavaScript.ppt
FSJavaScript.ppt
 
Javascript
JavascriptJavascript
Javascript
 
Java script basics
Java script basicsJava script basics
Java script basics
 
Web programming
Web programmingWeb programming
Web programming
 
Unit 2.4
Unit 2.4Unit 2.4
Unit 2.4
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
Unit 2.4
Unit 2.4Unit 2.4
Unit 2.4
 
Javascript part1
Javascript part1Javascript part1
Javascript part1
 
Java script
Java scriptJava script
Java script
 
FYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptFYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III Javascript
 
wp-UNIT_III.pptx
wp-UNIT_III.pptxwp-UNIT_III.pptx
wp-UNIT_III.pptx
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
 
Web designing unit 4
Web designing unit 4Web designing unit 4
Web designing unit 4
 
Java scripts
Java scriptsJava scripts
Java scripts
 
Popup boxes
Popup boxesPopup boxes
Popup boxes
 
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atlGutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
 
Java script
 Java script Java script
Java script
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
 
13-IntroJavascript.pptxIntroduction to java script
13-IntroJavascript.pptxIntroduction to java script13-IntroJavascript.pptxIntroduction to java script
13-IntroJavascript.pptxIntroduction to java script
 
13-IntroJavascript.pptx
13-IntroJavascript.pptx13-IntroJavascript.pptx
13-IntroJavascript.pptx
 

Recently uploaded

不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
bseovas
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
Azure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdfAzure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdf
AanSulistiyo
 
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
bseovas
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
uehowe
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
hackersuli
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
cuobya
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
ukwwuq
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
Toptal Tech
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
vmemo1
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
Laura Szabó
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
Danica Gill
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 

Recently uploaded (20)

不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
Azure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdfAzure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdf
 
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 

Message Box in JS

  • 1. JAVASCRIPT POPUP BOXES Zakho Technical Institute IT Dept. 16-Feb.-2015
  • 2. JAVASCRIPT POPUP BOXES  There are three message boxes: alert, confirm, and prompt. Let's look at the first one:
  • 3. ALERT  An alert box is often used if you want to make sure information comes through to the user.  When an alert box pops up, the user will have to click "OK" to proceed.  <body>  <script>  alert("Welcome to my site!")  </script>  </body> You can put whatever you want inside the quotation marks.
  • 4. CONFIRM  <body>  <script>  confirm("Are you sure you want to quit?")  </script>  </body>
  • 5. PROMPT  Prompt box is used to allow a user to enter something according the promotion:
  • 6. EXAMPLE  <script>  var x=confirm("Are you sure you want to quit")  if (x)  alert("Thank you.")  else  alert("Good choice.")  </script>
  • 7. EXAMPLE  <html><head> <script>  var x=confirm("Are you sure you want to quit?")  if (!x)  location="http://www.yahoo.com" </script></head>  <body> Welcome to my website!.  </body></html>If you click "cancel", it will take you to yahoo, and clicking ok will continue with the loading of the current page "Welcome to my website!". Note:if (!x)means: if click "cancel". In JavaScript, the exclamation mark ! means: "none".
  • 8. EVENT HANDLER  What are event handlers? They can be considered as triggers that execute JavaScript when something happens, such as click or move your mouse over a link, submit a form etc.
  • 9.  onClick onClick handlers execute something only when users click on buttons, links, etc. Let's see an example:  <script>  function ss()  { alert("Thank you!") }  </script>  <form>  <input type="button" value="Click here" onclick="ss()">  </form> The function ss() is invoked when the user clicks the button. Note: Event handlers are not added inside the<script> tags, but rather, inside the html tags.
  • 10. JAVASCRIPT SPECIAL CHARACTERS  In JavaScript you can add special characters to a text string byInsert Special Characters  The backslash () is used to insert apostrophes, new lines, quotes, and other special characters into a text string.  Look at the following JavaScript code:  using the backslash sign.
  • 11. EXAMPLE  var txt="We are the so-called "Vikings" from the north."; document.write(txt);  In JavaScript, a string is started and stopped with either single or double quotes. This means that the string above will be chopped to: We are the so-called  To solve this problem, you must place a backslash () before each double quote in "Viking". This turns each double quote into a string literal:
  • 12. EXAMPLE  var txt="We are the so-called "Vikings" from the north."; document.write(txt);  JavaScript will now output the proper text string: We are the so-called "Vikings" from the north.  The table below lists other special characters that can be added to a text string with the backslash sign:
  • 13. TABLE
  • 14. BREAK UP LINE  document.write("Hello World!");  or  document.write ("Hello World!");  which is right ...?
  • 15. ARRAY  Create an Array  An array can be defined in three ways.  The following code creates an Array object called myCars:  var myCars=new Array(); // regular array (add an optional integer myCars[0]="Saab"; // argument to control array's size) myCars[1]="Volvo"; myCars[2]="BMW";
  • 16. ARRAY  var myCars=new Array("Saab","Volvo","BMW"); // condensed array  var myCars=["Saab","Volvo","BMW"]; // literal array
  • 17. ACCESS AN ARRAY  You can refer to a particular element in an array by referring to the name of the array and the index number. The index number starts at 0.  The following code line:  Document.write(myCars[0]);  will result in the following output:  Saab
  • 18. EXAMPLE  Create an array for Web shoppe contains 5 element:  customer's name  customer's date of birth  customer's address  customer's phone number  total bill amount
  • 20. QUESTIONS GAME .....  Choose ur favourite no. 1 2 15 3 4 5 6 7 8 9 10 12 16 14 12 13 1 11
  • 21. 1  True or false :  JS is usually embedded directly into html pages ................
  • 22. 2  How can u write a comments in JS ....?
  • 23. 3  The “radio” element used for selecting one of many choice ....>>>>> T or F ......
  • 24. 4  The <txet area> defines a multiline input field (a text area).. T or F
  • 25. 5  The “checkbox” is the same as “radiobutton”...  T or F
  • 26. 6  In CSS .... Border clear an area around the contents ..  T or F .. Correct if F
  • 27. 7  What is the full word of HTML .....?
  • 28. 8  JS is sensitive for letter ....isn’t it ?explain
  • 30. 10  Http mean” Hyper ......... ........ ........”
  • 31. 11  Can you clarify the meaning of “URL” ..?
  • 32. 12  What is CSS ?
  • 33. 13  Clarify with example the syntax of CSS ...
  • 34. 14  The id selector is defined with “{“ ...  T or F
  • 35. 15  What are event handlers?
  • 36. 16  How many message boxes did we have in JS ?  Explain with examples......

Editor's Notes

  1. TRue
  2. //
  3. T
  4. F
  5. F
  6. F “Padding” Or Contents and padding
  7. Hyper text markup lang
  8. The internet
  9. Uniform Resource Locator 1- protocol part 2-host part 3-document part
  10. Cascade style sheet Styles defines how to display html elements
  11. H1 {color:blue;font-size:12px;} Selector proprty:value
  12. F #