SlideShare uma empresa Scribd logo
1 de 18
Ayes Chinmay
Internet
&
Web Technology
(CSS and JavaScript)
IWT Syllabus:
Module 2:
Java Script
Scripting: Java script: Introduction, statements, comments, variables, operators, documents,
forms, functions, objects, events, Strings, Numbers, Arrays, Date, Math, Random, Loops,
Regxp, errors, this, Let, Const., classes, debugging .
The HTML DOM (Document Object Model)
Introduction, DOM Methods, DOM Document, DOM Elements , DOM HTML, DOM CSS,
DOM Events, DOM Navigation, DOM Nodes , DOM Nodelist
The Browser Object Model (BOM)
The Window Object, Window Size, Window History, Window Navigator, Browser Detection,
JavaScript Timing Events, Cookies, Working on Cookies using Java script.
CSS:
 CSS stands for Cascaded Style Sheet.
 Wium Lie has proposed the concept of CSS in 1994 (26 years ago).
 The latest version of CSS 3 was published in 1999. World Wide Web
Consortium (W3C) defines the specifications of CSS.
 Father of HTML 5, CSS 3 => “Håkon Wium Lie”Håkon Wium Lie
CSS Syntax:
Types of CSS:
1) External CSS
2) Internal CSS
3) Inline CSS
External CSS:
 With an external style sheet, you can change the look of an entire website by
changing just one file.
 Each HTML page must include a reference to the external style sheet file inside
the <link> element, inside the head section.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
Internal CSS:
 An inline style may be used to apply a unique style for a single element.
 To use inline styles, add the style attribute to the relevant element. The
style attribute can contain any CSS property.
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: linen;}
h1 {color: maroon;
margin-left: 40px; }
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Inline CSS:
 An inline style may be used to apply a unique style for a single element.
 To use inline styles, add the style attribute to the relevant element. The
style attribute can contain any CSS property.
<!DOCTYPE html>
<html>
<body>
<h1 style="color:blue;text-align:center;">
This is a heading
</h1>
<p style="color:red;">
This is a paragraph.
</p>
</body>
</html>
JavaScript:
 JavaScript enables interactive web pages and is an essential part of web
applications.
 First released in December 4, 1995 (24 years ago).
 JavaScript is the dominant client-side scripting language of the Web,
with 95% of websites using it for this purpose.
 All major web browsers have a built-in JavaScript engine that executes
the code on the user's device.
 "JavaScript" is a trademark of Oracle Corporation in the United States.
Brendan Eich
JavaScript Syntax:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Strings</h2>
<p>Strings can be written with double or single quotes.</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 'John Doe';
</script>
</body>
</html>
JavaScript Function:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript in Body</h2>
<p id="demo">A Paragraph.</p>
<button type="button" onclick="myFunction()">Try it</button>
<button type="button" onclick="myFunction1()">Try it1</button>
</body>
</html>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph
changed.";
}
function myFunction1() {
document.getElementById("demo").innerHTML = "Paragraph
changed1.";
}
</script>
JavaScript Random Function:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Math.random()</h2>
<p>Math.random() returns a random number between 0 (included) and 1
(excluded):</p>
<button onclick="check()"> Random </button>
<p id="demo"></p>
<script>
var a=10;
function check(){
document.getElementById("demo").innerHTML = a*Math.random();
}
</script>
</body>
</html>
JavaScript Array:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Arrays</h2>
<p>JavaScript array elements are accessed using numeric indexes
(starting from 0).</p>
<p id="demo"></p>
<script>
var cars = ["Saab", "Volvo", "BMW"];
document.getElementById("demo").innerHTML = cars[0];
</script>
</body>
</html>
JavaScript Regular Expression:
 A regular expression is a sequence of characters that forms a search pattern.
 The search pattern can be used for text search and text replace operations.
What Is a Regular Expression?
 A regular expression is a sequence of characters that forms a search pattern.
 When you search for data in a text, you can use this search pattern to describe
what you are searching for.
 A regular expression can be a single character, or a more complicated pattern.
 Regular expressions can be used to perform all types of text search and text
replace operations.
JavaScript replace() & search():
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Regular Expressions</h2>
<p>Replace "microsoft" with "W3Schools" in the paragraph below:</p>
<button onclick="myFunction()">Try it</button>
<p id="demo">Please visit Microsoft and Microsoft!</p>
<script>
function myFunction() {
var str = document.getElementById("demo").innerHTML;
var txt = str.replace(/microsoft/i,"W3Schools");
document.getElementById("demo").innerHTML = txt;
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Regular Expressions</h2>
<p>Search a string for "w3Schools", and display the position of the
match:</p>
<p id="demo"></p>
<script>
var str = "Visit W3Schools!";
var n = str.search(/w3Schools/i);
document.getElementById("demo").innerHTML = n;
</script>
</body>
</html>
Model Questions:
1. The correct syntax for adding yellow as a background
colour in HTML is:
(a) < body style="background-color:yellow">
(b) <backgroundcolor>yellow</background color>
(c) <color.background="yellow">
(d) <backgrndcolor="yellow">
2. The HTML tag used to make a text italic is
(a) <italic> (b) <i>
(c) <textitalic> (d) <slantingtext>
Model Questions: (Cont.)
3. The HTML tag used to define an internal style sheet is
(a) <style> (b) <stylesheet>
(c) <css> (d) <internal link>
4. JavaScript is defined under which HTML element?
(a) <jscript> (b) <script>
(c) <scriptjava> (d) <define.js>
5. Which of the following statements is used for creating
a function?
(a) function=Functionname()
(b) function Functionname()
(c) function:Functionname()
(d) function "Functionname"
Next Class:
HTML DOM

Mais conteúdo relacionado

Mais procurados

Document Object Model
Document Object ModelDocument Object Model
Document Object Model
chomas kandar
 

Mais procurados (20)

Web Information Systems Html and css
Web Information Systems Html and cssWeb Information Systems Html and css
Web Information Systems Html and css
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Boostrap basics
Boostrap basicsBoostrap basics
Boostrap basics
 
Html - By Auroskkil
Html - By AuroskkilHtml - By Auroskkil
Html - By Auroskkil
 
CSS-3 Course Slide
CSS-3 Course SlideCSS-3 Course Slide
CSS-3 Course Slide
 
XHTML
XHTMLXHTML
XHTML
 
Hushang Gaikwad
Hushang GaikwadHushang Gaikwad
Hushang Gaikwad
 
Dhtml
DhtmlDhtml
Dhtml
 
Html css workshop, lesson 0, how browsers work
Html css workshop, lesson 0, how browsers workHtml css workshop, lesson 0, how browsers work
Html css workshop, lesson 0, how browsers work
 
Internet and Web Technology (CLASS-6) [BOM]
Internet and Web Technology (CLASS-6) [BOM] Internet and Web Technology (CLASS-6) [BOM]
Internet and Web Technology (CLASS-6) [BOM]
 
Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
 
Html & CSS
Html & CSSHtml & CSS
Html & CSS
 
HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
Dhtml ppt (2)
Dhtml ppt (2)Dhtml ppt (2)
Dhtml ppt (2)
 
How the Web Works Using HTML
How the Web Works Using HTMLHow the Web Works Using HTML
How the Web Works Using HTML
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Basic Details of HTML and CSS.pdf
Basic Details of HTML and CSS.pdfBasic Details of HTML and CSS.pdf
Basic Details of HTML and CSS.pdf
 

Semelhante a Internet and Web Technology (CLASS-4) [CSS & JS]

GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
Heather Rock
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1
Aslam Najeebdeen
 

Semelhante a Internet and Web Technology (CLASS-4) [CSS & JS] (20)

Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
A quick guide to Css and java script
A quick guide to Css and  java scriptA quick guide to Css and  java script
A quick guide to Css and java script
 
Overview of PHP and MYSQL
Overview of PHP and MYSQLOverview of PHP and MYSQL
Overview of PHP and MYSQL
 
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
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucks
 
WEB DEVELOPMENT
WEB DEVELOPMENTWEB DEVELOPMENT
WEB DEVELOPMENT
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1
 
JavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxJavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptx
 
Web performance essentials - Goodies
Web performance essentials - GoodiesWeb performance essentials - Goodies
Web performance essentials - Goodies
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery TrainingCartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
 
HTML_CSS_JS Workshop
HTML_CSS_JS WorkshopHTML_CSS_JS Workshop
HTML_CSS_JS Workshop
 
html5_css3
html5_css3html5_css3
html5_css3
 
Introduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and JqueryIntroduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and Jquery
 
Introduction to whats new in css3
Introduction to whats new in css3Introduction to whats new in css3
Introduction to whats new in css3
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
SDP_-_Module_4.ppt
SDP_-_Module_4.pptSDP_-_Module_4.ppt
SDP_-_Module_4.ppt
 
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 

Mais de Ayes Chinmay

Mais de Ayes Chinmay (7)

Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
 
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
 
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
 
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
 
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web TechnologyInternet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
 
Internet and Web Technology (CLASS-2) [HTTP & HTML]
Internet and Web Technology (CLASS-2) [HTTP & HTML]Internet and Web Technology (CLASS-2) [HTTP & HTML]
Internet and Web Technology (CLASS-2) [HTTP & HTML]
 
Internet and Web Technology (CLASS-1) [Introduction]
Internet and Web Technology (CLASS-1) [Introduction]Internet and Web Technology (CLASS-1) [Introduction]
Internet and Web Technology (CLASS-1) [Introduction]
 

Último

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Último (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 

Internet and Web Technology (CLASS-4) [CSS & JS]

  • 2. IWT Syllabus: Module 2: Java Script Scripting: Java script: Introduction, statements, comments, variables, operators, documents, forms, functions, objects, events, Strings, Numbers, Arrays, Date, Math, Random, Loops, Regxp, errors, this, Let, Const., classes, debugging . The HTML DOM (Document Object Model) Introduction, DOM Methods, DOM Document, DOM Elements , DOM HTML, DOM CSS, DOM Events, DOM Navigation, DOM Nodes , DOM Nodelist The Browser Object Model (BOM) The Window Object, Window Size, Window History, Window Navigator, Browser Detection, JavaScript Timing Events, Cookies, Working on Cookies using Java script.
  • 3. CSS:  CSS stands for Cascaded Style Sheet.  Wium Lie has proposed the concept of CSS in 1994 (26 years ago).  The latest version of CSS 3 was published in 1999. World Wide Web Consortium (W3C) defines the specifications of CSS.  Father of HTML 5, CSS 3 => “Håkon Wium Lie”Håkon Wium Lie
  • 5. Types of CSS: 1) External CSS 2) Internal CSS 3) Inline CSS
  • 6. External CSS:  With an external style sheet, you can change the look of an entire website by changing just one file.  Each HTML page must include a reference to the external style sheet file inside the <link> element, inside the head section. <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html> body { background-color: lightblue; } h1 { color: navy; margin-left: 20px; }
  • 7. Internal CSS:  An inline style may be used to apply a unique style for a single element.  To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property. <!DOCTYPE html> <html> <head> <style> body {background-color: linen;} h1 {color: maroon; margin-left: 40px; } </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
  • 8. Inline CSS:  An inline style may be used to apply a unique style for a single element.  To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property. <!DOCTYPE html> <html> <body> <h1 style="color:blue;text-align:center;"> This is a heading </h1> <p style="color:red;"> This is a paragraph. </p> </body> </html>
  • 9. JavaScript:  JavaScript enables interactive web pages and is an essential part of web applications.  First released in December 4, 1995 (24 years ago).  JavaScript is the dominant client-side scripting language of the Web, with 95% of websites using it for this purpose.  All major web browsers have a built-in JavaScript engine that executes the code on the user's device.  "JavaScript" is a trademark of Oracle Corporation in the United States. Brendan Eich
  • 10. JavaScript Syntax: <!DOCTYPE html> <html> <body> <h2>JavaScript Strings</h2> <p>Strings can be written with double or single quotes.</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = 'John Doe'; </script> </body> </html>
  • 11. JavaScript Function: <!DOCTYPE html> <html> <body> <h2>JavaScript in Body</h2> <p id="demo">A Paragraph.</p> <button type="button" onclick="myFunction()">Try it</button> <button type="button" onclick="myFunction1()">Try it1</button> </body> </html> <script> function myFunction() { document.getElementById("demo").innerHTML = "Paragraph changed."; } function myFunction1() { document.getElementById("demo").innerHTML = "Paragraph changed1."; } </script>
  • 12. JavaScript Random Function: <!DOCTYPE html> <html> <body> <h2>JavaScript Math.random()</h2> <p>Math.random() returns a random number between 0 (included) and 1 (excluded):</p> <button onclick="check()"> Random </button> <p id="demo"></p> <script> var a=10; function check(){ document.getElementById("demo").innerHTML = a*Math.random(); } </script> </body> </html>
  • 13. JavaScript Array: <!DOCTYPE html> <html> <body> <h2>JavaScript Arrays</h2> <p>JavaScript array elements are accessed using numeric indexes (starting from 0).</p> <p id="demo"></p> <script> var cars = ["Saab", "Volvo", "BMW"]; document.getElementById("demo").innerHTML = cars[0]; </script> </body> </html>
  • 14. JavaScript Regular Expression:  A regular expression is a sequence of characters that forms a search pattern.  The search pattern can be used for text search and text replace operations. What Is a Regular Expression?  A regular expression is a sequence of characters that forms a search pattern.  When you search for data in a text, you can use this search pattern to describe what you are searching for.  A regular expression can be a single character, or a more complicated pattern.  Regular expressions can be used to perform all types of text search and text replace operations.
  • 15. JavaScript replace() & search(): <!DOCTYPE html> <html> <body> <h2>JavaScript Regular Expressions</h2> <p>Replace "microsoft" with "W3Schools" in the paragraph below:</p> <button onclick="myFunction()">Try it</button> <p id="demo">Please visit Microsoft and Microsoft!</p> <script> function myFunction() { var str = document.getElementById("demo").innerHTML; var txt = str.replace(/microsoft/i,"W3Schools"); document.getElementById("demo").innerHTML = txt; } </script> </body> </html> <!DOCTYPE html> <html> <body> <h2>JavaScript Regular Expressions</h2> <p>Search a string for "w3Schools", and display the position of the match:</p> <p id="demo"></p> <script> var str = "Visit W3Schools!"; var n = str.search(/w3Schools/i); document.getElementById("demo").innerHTML = n; </script> </body> </html>
  • 16. Model Questions: 1. The correct syntax for adding yellow as a background colour in HTML is: (a) < body style="background-color:yellow"> (b) <backgroundcolor>yellow</background color> (c) <color.background="yellow"> (d) <backgrndcolor="yellow"> 2. The HTML tag used to make a text italic is (a) <italic> (b) <i> (c) <textitalic> (d) <slantingtext>
  • 17. Model Questions: (Cont.) 3. The HTML tag used to define an internal style sheet is (a) <style> (b) <stylesheet> (c) <css> (d) <internal link> 4. JavaScript is defined under which HTML element? (a) <jscript> (b) <script> (c) <scriptjava> (d) <define.js> 5. Which of the following statements is used for creating a function? (a) function=Functionname() (b) function Functionname() (c) function:Functionname() (d) function "Functionname"