SlideShare a Scribd company logo
1 of 37
Web Engineering
Mam Alia
In HTML an image map is a list of coordinates relating to a
specific image, created in order to hyperlink areas of
the image to different destinations (as opposed to a
normal image link, in which the entire area of
the image links to a single destination).
In HTML an image map is a list of coordinates relating to a
specific image, created in order to hyperlink areas of
the image to different destinations (as opposed to a
normal image link, in which the entire area of
the image links to a single destination).
<html><head></head><body>
<h1> Image Mapping </h1>
<map name="imgmap">
<center><img src="aos.png" usemap="#Asad"> </center>
<map name="Asad">
<area shape="rect" coords="1,253,170,511" href="#ASAD">
<area shape="circle" coords="324,408,77"href="#saad">
<area shape="poly" coords="314,71,295,130,297,234,406,233,401,221"
href="#Mussadiq">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<h1><a name="ASAD">ASAD</a></h1>
<img src="420227.jpg">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<h1><a name="saad">saad</a></h1>
<img src="WEB.png">
<h1><a name="Mussadiq">Mussadiq</a></h1>
<img src="cc.png">
</body>
</html>
<area>-tag
<area shape="circle" coords="x,y,radius"href="file.html">
<area shape="rect" coords="x1,y1,x2,y2"href="file.html">
<area shape="poly" coords="x1,y1,…,xn,yn" href="file.html">
<h1><a name="ABC">ASAD</a></h1>
<img src=“Addres.type">
<h1><a name="ABC">ASAD</a></h1>
<img src=“Addres.type">
Single Selector
Child Selector
Descendant Selector
Adjacent Sibling Selector
General Sibling Selector
Single Selector
Child Selector
Descendant Selector
Adjacent Sibling Selector
General Sibling Selector
Single Selector
H1{
COLOR:RED;
}
Just effect on single tag
Child Selector
div > h1
{
color:green;
background-color:orange;
}
If have to apply on all tags in one Div or Box
Descendant Selector
div p
{
color:red;
background-color:gray;
}
Same as Child but work on 1st
tag
Adjacent Sibling Selector
h1+p+p
{
background-color:yellow;
}
Tag a specific tag after tag
The upper tag will effect only
Those p tag exist after h1->p->p
General Sibling Selector
h1 ~ p{ text-decoration:underline; }
It effect all tags after h1 paragraph
Script is a short piece of Program or a code.
We can add it by using <script>…</script>
In Html code.
• The <script> tag is used to define a client-
side script (JavaScript).
• The <script> element either contains
scripting statements, or it points to an
external script file through the src attribute.
• Common uses for JavaScript are image
manipulation, form validation,
and dynamic changes of content.
JavaScript != Java
JavaScript Variables :
• Variables are used to store data.
• A variable is a "container" for information you
want to store. A variable's value can change
during the script. You can refer to a variable by
name to see its value or to change its value.
• Rules for variable names:
– Variable names are case sensitive
– They must begin with a letter or the underscore
character
• strname – STRNAME (not same)
JavaScript Basic Examples
1) Output to a Browser Display
<html>
<head></head>
<body>
<script>
document.write("BsCs Web Engineering Class");
</script>
</body>
</html>
JavaScript Basic Examples
1) Output to a Browser Display
<html>
<head></head>
<body>
<script>
document.write("BsCs Web Engineering Class");
</script>
</body>
</html>
Output 
2) Creating a variable in JavaScript
Here variable can automatically sense the
data type .
var name_of_variable ;
Var = Is keyword for declaring a variable
; = termination Sign
2) Creating a variable in JavaScript
var a=5;
var b=“Asad”;
document.write(a); is will show 5 on screen
document.write(b); is will show Asad
2) Creating a variable in JavaScript
var a=5;
var b=“Asad”;
var ara= new Array(length);
ara[0]=“Asad”;
ara[1]=122;
So on…
3) Operations In JavaScripts
<html><head></head><body><font size=12>
<script>
var a=5;
var b=10;
var c=a+b;
document.write(c);
</script>
</font></body></html>
3) Operations In JavaScripts
<html><head></head><body><font size=12>
<script>
var a=5;
var b=10;
var c=a+b;
document.write(c);
</script>
</font></body></html>
Output 
Same for other operation .
Can use increment and decrement .
4) Functions in JavaScripts
<html><head>
<script>
function Asad(){document.write("Pak Pak
Pakistan")}
</script>
</head><body>
<script>Asad();</script>
</body></html>
4) Functions in JavaScripts
<html><head>
<script>
function Asad(){document.write("Pak Pak
Pakistan")}
</script>
</head><body>
<script>Asad();</script>
</body></html>
Output 
Flow Control Statements
5) If statement
<html><head></head><body><font size=12><script>
var a=5;
if(a>=5)
{
document.write("A is greater or Equal to 5");}
else
{
document.write("A is smaller then 5");
}
</script></font></body></html>
6) For Loop
<html><head></head><body><script>
for(i=1;i<6;i++)
{
document.write("BsCs Web Engineering
Class"+"<br>");
}
</script></body></html>
6) For Loop
<html><head></head><body><script>
for(i=1;i<6;i++)
{
document.write("BsCs Web Engineering
Class"+"<br>");
}
</script></body></html>
Output 
Dialog Boxes
• The alert dialog box
<script> alert(“Message”);</script>
• The confirm dialog box
<script> variable= confirm(“Message”);</script>
• The prompt dialog box
<script> variable=prompt(“Message”[“Default value”]);</script>
St=prompt(“Enter Name of city”,”Layyah”);
Confirm(“you entered city name :”+st);
Class selectors
Class selectors

More Related Content

Similar to Class selectors

Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Erin M. Kidwell
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3Gopi A
 
PPT on javascript ajax and css and some points related to server
PPT on javascript ajax and css and some points related to serverPPT on javascript ajax and css and some points related to server
PPT on javascript ajax and css and some points related to servershivanichourasia01
 
Internet and Web Technology (CLASS-4) [CSS & JS]
Internet and Web Technology (CLASS-4) [CSS & JS] Internet and Web Technology (CLASS-4) [CSS & JS]
Internet and Web Technology (CLASS-4) [CSS & JS] Ayes Chinmay
 
Styling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS EditionStyling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS Editionbensmithett
 
Styling components with JavaScript
Styling components with JavaScriptStyling components with JavaScript
Styling components with JavaScriptbensmithett
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012crokitta
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksAndolasoft Inc
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucksTim Wright
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid PrototypingEven Wu
 
HTML Foundations, part 1
HTML Foundations, part 1HTML Foundations, part 1
HTML Foundations, part 1Shawn Calvert
 

Similar to Class selectors (20)

Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
Tags
TagsTags
Tags
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
PPT on javascript ajax and css and some points related to server
PPT on javascript ajax and css and some points related to serverPPT on javascript ajax and css and some points related to server
PPT on javascript ajax and css and some points related to server
 
Internet and Web Technology (CLASS-4) [CSS & JS]
Internet and Web Technology (CLASS-4) [CSS & JS] Internet and Web Technology (CLASS-4) [CSS & JS]
Internet and Web Technology (CLASS-4) [CSS & JS]
 
Styling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS EditionStyling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS Edition
 
Styling components with JavaScript
Styling components with JavaScriptStyling components with JavaScript
Styling components with JavaScript
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
 
Wt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technologyWt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technology
 
Wt unit 2 ppts client side technology
Wt unit 2 ppts client side technologyWt unit 2 ppts client side technology
Wt unit 2 ppts client side technology
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
 
html-css
html-csshtml-css
html-css
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Html 5
Html   5Html   5
Html 5
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucks
 
Html
HtmlHtml
Html
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
HTML Foundations, part 1
HTML Foundations, part 1HTML Foundations, part 1
HTML Foundations, part 1
 
Java script
Java scriptJava script
Java script
 

More from ITz_1

Data Mining in Operating System
Data Mining in Operating SystemData Mining in Operating System
Data Mining in Operating SystemITz_1
 
Software designm complexity
Software designm complexitySoftware designm complexity
Software designm complexityITz_1
 
Linux operating system
Linux operating systemLinux operating system
Linux operating systemITz_1
 
Embedded Software
Embedded SoftwareEmbedded Software
Embedded SoftwareITz_1
 
5 major social institutions
5 major social institutions5 major social institutions
5 major social institutionsITz_1
 
Java script programs
Java script programsJava script programs
Java script programsITz_1
 
Java script
Java scriptJava script
Java scriptITz_1
 

More from ITz_1 (8)

Data Mining in Operating System
Data Mining in Operating SystemData Mining in Operating System
Data Mining in Operating System
 
Software designm complexity
Software designm complexitySoftware designm complexity
Software designm complexity
 
Linux operating system
Linux operating systemLinux operating system
Linux operating system
 
Embedded Software
Embedded SoftwareEmbedded Software
Embedded Software
 
PCI
PCIPCI
PCI
 
5 major social institutions
5 major social institutions5 major social institutions
5 major social institutions
 
Java script programs
Java script programsJava script programs
Java script programs
 
Java script
Java scriptJava script
Java script
 

Recently uploaded

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Recently uploaded (20)

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 

Class selectors

  • 2.
  • 3.
  • 4.
  • 5.
  • 6. In HTML an image map is a list of coordinates relating to a specific image, created in order to hyperlink areas of the image to different destinations (as opposed to a normal image link, in which the entire area of the image links to a single destination).
  • 7. In HTML an image map is a list of coordinates relating to a specific image, created in order to hyperlink areas of the image to different destinations (as opposed to a normal image link, in which the entire area of the image links to a single destination).
  • 8. <html><head></head><body> <h1> Image Mapping </h1> <map name="imgmap"> <center><img src="aos.png" usemap="#Asad"> </center> <map name="Asad"> <area shape="rect" coords="1,253,170,511" href="#ASAD"> <area shape="circle" coords="324,408,77"href="#saad"> <area shape="poly" coords="314,71,295,130,297,234,406,233,401,221" href="#Mussadiq"> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <h1><a name="ASAD">ASAD</a></h1> <img src="420227.jpg"> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <h1><a name="saad">saad</a></h1> <img src="WEB.png"> <h1><a name="Mussadiq">Mussadiq</a></h1> <img src="cc.png"> </body> </html>
  • 9. <area>-tag <area shape="circle" coords="x,y,radius"href="file.html"> <area shape="rect" coords="x1,y1,x2,y2"href="file.html"> <area shape="poly" coords="x1,y1,…,xn,yn" href="file.html">
  • 12. Single Selector Child Selector Descendant Selector Adjacent Sibling Selector General Sibling Selector
  • 13. Single Selector Child Selector Descendant Selector Adjacent Sibling Selector General Sibling Selector
  • 15. Child Selector div > h1 { color:green; background-color:orange; } If have to apply on all tags in one Div or Box
  • 17. Adjacent Sibling Selector h1+p+p { background-color:yellow; } Tag a specific tag after tag The upper tag will effect only Those p tag exist after h1->p->p
  • 18. General Sibling Selector h1 ~ p{ text-decoration:underline; } It effect all tags after h1 paragraph
  • 19.
  • 20. Script is a short piece of Program or a code. We can add it by using <script>…</script> In Html code.
  • 21. • The <script> tag is used to define a client- side script (JavaScript). • The <script> element either contains scripting statements, or it points to an external script file through the src attribute. • Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.
  • 22. JavaScript != Java JavaScript Variables : • Variables are used to store data. • A variable is a "container" for information you want to store. A variable's value can change during the script. You can refer to a variable by name to see its value or to change its value. • Rules for variable names: – Variable names are case sensitive – They must begin with a letter or the underscore character • strname – STRNAME (not same)
  • 23. JavaScript Basic Examples 1) Output to a Browser Display <html> <head></head> <body> <script> document.write("BsCs Web Engineering Class"); </script> </body> </html>
  • 24. JavaScript Basic Examples 1) Output to a Browser Display <html> <head></head> <body> <script> document.write("BsCs Web Engineering Class"); </script> </body> </html> Output 
  • 25. 2) Creating a variable in JavaScript Here variable can automatically sense the data type . var name_of_variable ; Var = Is keyword for declaring a variable ; = termination Sign
  • 26. 2) Creating a variable in JavaScript var a=5; var b=“Asad”; document.write(a); is will show 5 on screen document.write(b); is will show Asad
  • 27. 2) Creating a variable in JavaScript var a=5; var b=“Asad”; var ara= new Array(length); ara[0]=“Asad”; ara[1]=122; So on…
  • 28. 3) Operations In JavaScripts <html><head></head><body><font size=12> <script> var a=5; var b=10; var c=a+b; document.write(c); </script> </font></body></html>
  • 29. 3) Operations In JavaScripts <html><head></head><body><font size=12> <script> var a=5; var b=10; var c=a+b; document.write(c); </script> </font></body></html> Output  Same for other operation . Can use increment and decrement .
  • 30. 4) Functions in JavaScripts <html><head> <script> function Asad(){document.write("Pak Pak Pakistan")} </script> </head><body> <script>Asad();</script> </body></html>
  • 31. 4) Functions in JavaScripts <html><head> <script> function Asad(){document.write("Pak Pak Pakistan")} </script> </head><body> <script>Asad();</script> </body></html> Output 
  • 32. Flow Control Statements 5) If statement <html><head></head><body><font size=12><script> var a=5; if(a>=5) { document.write("A is greater or Equal to 5");} else { document.write("A is smaller then 5"); } </script></font></body></html>
  • 33. 6) For Loop <html><head></head><body><script> for(i=1;i<6;i++) { document.write("BsCs Web Engineering Class"+"<br>"); } </script></body></html>
  • 34. 6) For Loop <html><head></head><body><script> for(i=1;i<6;i++) { document.write("BsCs Web Engineering Class"+"<br>"); } </script></body></html> Output 
  • 35. Dialog Boxes • The alert dialog box <script> alert(“Message”);</script> • The confirm dialog box <script> variable= confirm(“Message”);</script> • The prompt dialog box <script> variable=prompt(“Message”[“Default value”]);</script> St=prompt(“Enter Name of city”,”Layyah”); Confirm(“you entered city name :”+st);