SlideShare a Scribd company logo
Course Code: CSE 202
Course Title: Computer Programming Lab
Lecture 1: Introduction
Course Teacher: Saurav Barua (SB)
Assistant Professor, Dept. of CE, DIU
Phone: +88-01715334075
Email: saurav.ce@diu.edu.bd
Contents
2
Link CSS and JS
with HTML
Visual Studio
(VS) code
Installation of
VS code.
HTML and CSS
Introduction to
JavaScript (JS)
.
console.log(),
prompt() and
alert() methods.
Introduction to JavaScript (.js)
• JavaScript (JS) is the world's most popular
programming language.
• JS is the programming language of the Web.
• It can be run either in the web-browser console
directly or through IDE along with HTML and CSS.
• HTML provides structure, CSS provides style and JS
provides functionality in a web application.
3
Introduction to JavaScript (.js)
4
• Type http://localhost:8080/ in chrome browser.
• Press F12 and click console.
• write JavaScript code in the console.
Some methods in JS
5
Methods Description
console.log("text") This method writes a message to
the console and useful for testing
purposes.
alert("text") The method displays an alert box
with a message and an OK button.
prompt("text") The method displays a dialog box
that prompts the user for input.
Visual Studio code
• Visual Studio Code (VS code) is a streamlined code editor with
support for development operations like debugging, task
running, and version control.
• It aims to provide just the tools a developer needs for a quick
code-build-debug cycle and leaves more complex workflows to
fuller featured IDEs, such as Visual Studio IDE.
• It is not a language-specific IDE as you can use this to write
code in C#, C++, VB(Visual Basic), Python, JavaScript, and many
more languages.
6
Installation of VS code
• Download and install VS code from:
https://code.visualstudio.com/
7
VS code
8
Live server
9
▪ Makes the existing server,
live - this is a Web Extension
that helps you to live reload
feature for dynamic content.
▪ Install live server from the
VS code extension tab
located in the left sidebar.
Introduction to HTML and CSS
• Hypertext Markup Language (HTML) is the standard
markup language for documents designed to be
displayed in a web browser. It defines the content and
structure of web content.
• Cascading Style Sheets (CSS) is a style sheet language
used for specifying the presentation and styling of a
document.
10
Boilerplate code in html
11
Link JS and CSS with html
12
❑At the end of html head tag to add CSS file of name
style.css write:
<link rel="stylesheet" href="style.css">
❑At the end of html body tag to add CSS file of name
app.js write:
<script src="myscripts.js"></script>
Link JS and CSS with html
13
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script src="myscripts.js"></script>
</body>
</html>
Example 1
14
Write a program to link html, CSS and JS files, text in JS and display in the
browser.
Example 1
15
1. Program to link CSS and JS files with html and write text in JS and display in the
browser.
Google drive link:
https://drive.google.com/drive/folders/1pJ1_qHQPtkipWD
sYwrWvCy5EZVRMuaCi?usp=drive_link
Git-hub link:
https://github.com/sauravbarua02/introSpring25
Html codes
16
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-
scale=1.0">
<title>Text Display</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container" id="container">
</div>
<script src="app.js"></script>
</body>
</html>
CSS codes
17
body{
background-color: rgba(216, 119, 119,
0.3);
}
.container{
background-color: rgba(216, 119, 119,
0.6);
height: 400px;
width: 300px;
margin:5px auto;
padding: 5px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
JS codes
18
const containerEl =
document.getElementById("container");
containerEl.innerText = `Branches of Civil
Engineering are-
Sturctural Engineering,
Geotechnical Engineering
Transportation Engineering
Environmental Engineering
Water resource Engineering`;
Class tasks
19
Task 1.1: Program to link CSS and JS files with html, make background color blue,
write text (regarding application of Structural Engineering) in JS and display in the
browser.
Task 1.2: Program to link CSS and JS files with html, make background color purple,
write text (regarding application of Environmental Engineering) in JS and display in
the browser.
Task 1.3: Program to link CSS and JS files with html, make background color yellow,
write text (regarding application of Geotechnical Engineering) in JS and display in
the browser.
Task 1.4: Program to link CSS and JS files with html, make background color brown,
write text (regarding application of Transportation Engineering) in JS and display in
the browser.
Task 1.5: Program to link CSS and JS files with html, make background color red,
write text (regarding application of Water Resource Engineering) in JS and display in
the browser.
(hints: change background-color property in css and text inside backtick in JS.)
End of the Lecture
20

More Related Content

Similar to L1. Introduction, CSE 202, BN11.pdf JavaScript (20)

PPTX
EdTechJoker Spring 2020 - Lecture 4 - HTML
Bryan Ollendyke
 
PPTX
Tech Winter Break - GDG on Campus - PIET
khushi15250705
 
PPTX
PPT ON SEMINAR REPORT.pptx. bhvhvhchchvhchch
yashsharmaa0209
 
PPTX
Introduction to HTML+CSS+Javascript.pptx
deepuranjankumar2002
 
PPTX
Web development it slideWeb development it slidemy web development slide-...
AliyuUmarIsa
 
PPS
Web Designing
VNIT-ACM Student Chapter
 
PPTX
025444215.pptx
RiyaJenner1
 
PPTX
Web Development basics with WordPress
Rashna Maharjan
 
PDF
Web Dev - 1 PPT.pdf
gdsczhcet
 
PPT
Introduction to Web Technology and Web Page Development
BhargaviDalal4
 
PPTX
Introduction to HTML+CSS+Javascript.pptx
KADAMBARIPUROHIT
 
PPTX
Introduction to HTML+CSS+Javascript.pptx
AliRaza899305
 
PPTX
WELCOME (recovernjkgnjvnvnfjkvnjknnbfjked).pptx
HarshwardhanPatil52
 
KEY
Week 1
Will Gaybrick
 
KEY
Week 1 (v3)
Will Gaybrick
 
KEY
Week 1
Will Gaybrick
 
PPTX
Web development using HTML and CSS
SiddhantSingh980217
 
ODP
Light introduction to HTML
abidibo Contini
 
PPT
WebDev Simplified Day 1 ppt.ppt
SarikaPurohit1
 
PPTX
Introduction to HTML+CSS+Javascript.pptx
SadiaBaig6
 
EdTechJoker Spring 2020 - Lecture 4 - HTML
Bryan Ollendyke
 
Tech Winter Break - GDG on Campus - PIET
khushi15250705
 
PPT ON SEMINAR REPORT.pptx. bhvhvhchchvhchch
yashsharmaa0209
 
Introduction to HTML+CSS+Javascript.pptx
deepuranjankumar2002
 
Web development it slideWeb development it slidemy web development slide-...
AliyuUmarIsa
 
025444215.pptx
RiyaJenner1
 
Web Development basics with WordPress
Rashna Maharjan
 
Web Dev - 1 PPT.pdf
gdsczhcet
 
Introduction to Web Technology and Web Page Development
BhargaviDalal4
 
Introduction to HTML+CSS+Javascript.pptx
KADAMBARIPUROHIT
 
Introduction to HTML+CSS+Javascript.pptx
AliRaza899305
 
WELCOME (recovernjkgnjvnvnfjkvnjknnbfjked).pptx
HarshwardhanPatil52
 
Week 1 (v3)
Will Gaybrick
 
Web development using HTML and CSS
SiddhantSingh980217
 
Light introduction to HTML
abidibo Contini
 
WebDev Simplified Day 1 ppt.ppt
SarikaPurohit1
 
Introduction to HTML+CSS+Javascript.pptx
SadiaBaig6
 

More from SauravBarua11 (20)

PDF
L11, Project Survey , Spring 24, lecture notes, SB.pdf
SauravBarua11
 
PDF
L5, Computation of Area, Spring 24, SB.pdf
SauravBarua11
 
PDF
L4, Contour, Spring 24, lecture notes, SB.pdf
SauravBarua11
 
PDF
L3, Traverse Survey, Spring 24, lecture notes, SB.pdf
SauravBarua11
 
PDF
L8, Tacheometry survey, Spring 24, SB.pdf
SauravBarua11
 
PDF
L10, Astronomical surveying, Spring 24, SB.pdf
SauravBarua11
 
PDF
L6, Computation of Volume, Spring 24, SB.pdf
SauravBarua11
 
PDF
L9, photogrammetric survey, Spring 24, SB.pdf
SauravBarua11
 
PDF
L2, Level surveying, Spring 24,class notes, SB.pdf
SauravBarua11
 
PDF
Confusion matrix in Transportation Engineering.pdf
SauravBarua11
 
PDF
Ordinary least square (OLS) and MLE in Transportation Engineering.pdf
SauravBarua11
 
PDF
L5, Loop and iteration, CSE 202, BN11.pdf
SauravBarua11
 
PDF
L2. Function in JS, CSE 202, BN11.p1df documents
SauravBarua11
 
PDF
L6, Array in JS, CSE 202, BN11.pdf JavaScript
SauravBarua11
 
PDF
L4, Conditional statement, CSE 202 JavaScript
SauravBarua11
 
PDF
L3. Operators in JS, CSE 202, BN11.pdf JavaScript
SauravBarua11
 
PDF
L7. Object in JS, CSE 202, BN11.pdf JavaScript
SauravBarua11
 
PDF
L9. Math object in JS, CSE 202, BN11.pdf
SauravBarua11
 
PDF
L10. Math.random method in JS, CSE 202, BN11.pdf
SauravBarua11
 
PDF
L8. Constructor and method in JS, CSE 202, BN11.pdf
SauravBarua11
 
L11, Project Survey , Spring 24, lecture notes, SB.pdf
SauravBarua11
 
L5, Computation of Area, Spring 24, SB.pdf
SauravBarua11
 
L4, Contour, Spring 24, lecture notes, SB.pdf
SauravBarua11
 
L3, Traverse Survey, Spring 24, lecture notes, SB.pdf
SauravBarua11
 
L8, Tacheometry survey, Spring 24, SB.pdf
SauravBarua11
 
L10, Astronomical surveying, Spring 24, SB.pdf
SauravBarua11
 
L6, Computation of Volume, Spring 24, SB.pdf
SauravBarua11
 
L9, photogrammetric survey, Spring 24, SB.pdf
SauravBarua11
 
L2, Level surveying, Spring 24,class notes, SB.pdf
SauravBarua11
 
Confusion matrix in Transportation Engineering.pdf
SauravBarua11
 
Ordinary least square (OLS) and MLE in Transportation Engineering.pdf
SauravBarua11
 
L5, Loop and iteration, CSE 202, BN11.pdf
SauravBarua11
 
L2. Function in JS, CSE 202, BN11.p1df documents
SauravBarua11
 
L6, Array in JS, CSE 202, BN11.pdf JavaScript
SauravBarua11
 
L4, Conditional statement, CSE 202 JavaScript
SauravBarua11
 
L3. Operators in JS, CSE 202, BN11.pdf JavaScript
SauravBarua11
 
L7. Object in JS, CSE 202, BN11.pdf JavaScript
SauravBarua11
 
L9. Math object in JS, CSE 202, BN11.pdf
SauravBarua11
 
L10. Math.random method in JS, CSE 202, BN11.pdf
SauravBarua11
 
L8. Constructor and method in JS, CSE 202, BN11.pdf
SauravBarua11
 
Ad

Recently uploaded (20)

PPTX
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
DOCX
Engineering Geology Field Report to Malekhu .docx
justprashant567
 
PDF
FSE-Journal-First-Automated code editing with search-generate-modify.pdf
cl144
 
PDF
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
 
PPSX
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
 
PDF
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
PDF
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
PPT
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
PDF
CLIP_Internals_and_Architecture.pdf sdvsdv sdv
JoseLuisCahuanaRamos3
 
PPTX
CST413 KTU S7 CSE Machine Learning Neural Networks and Support Vector Machine...
resming1
 
PPTX
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
PDF
تقرير عن التحليل الديناميكي لتدفق الهواء حول جناح.pdf
محمد قصص فتوتة
 
PPTX
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
PPTX
Explore USA’s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
 
PPTX
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
 
PPTX
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
PPTX
ASBC application presentation template (ENG)_v3 (1).pptx
HassanMohammed730118
 
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
PDF
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
Engineering Geology Field Report to Malekhu .docx
justprashant567
 
FSE-Journal-First-Automated code editing with search-generate-modify.pdf
cl144
 
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
 
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
 
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
CLIP_Internals_and_Architecture.pdf sdvsdv sdv
JoseLuisCahuanaRamos3
 
CST413 KTU S7 CSE Machine Learning Neural Networks and Support Vector Machine...
resming1
 
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
تقرير عن التحليل الديناميكي لتدفق الهواء حول جناح.pdf
محمد قصص فتوتة
 
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
Explore USA’s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
 
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
 
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
ASBC application presentation template (ENG)_v3 (1).pptx
HassanMohammed730118
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
Ad

L1. Introduction, CSE 202, BN11.pdf JavaScript

  • 1. Course Code: CSE 202 Course Title: Computer Programming Lab Lecture 1: Introduction Course Teacher: Saurav Barua (SB) Assistant Professor, Dept. of CE, DIU Phone: +88-01715334075 Email: [email protected]
  • 2. Contents 2 Link CSS and JS with HTML Visual Studio (VS) code Installation of VS code. HTML and CSS Introduction to JavaScript (JS) . console.log(), prompt() and alert() methods.
  • 3. Introduction to JavaScript (.js) • JavaScript (JS) is the world's most popular programming language. • JS is the programming language of the Web. • It can be run either in the web-browser console directly or through IDE along with HTML and CSS. • HTML provides structure, CSS provides style and JS provides functionality in a web application. 3
  • 4. Introduction to JavaScript (.js) 4 • Type http://localhost:8080/ in chrome browser. • Press F12 and click console. • write JavaScript code in the console.
  • 5. Some methods in JS 5 Methods Description console.log("text") This method writes a message to the console and useful for testing purposes. alert("text") The method displays an alert box with a message and an OK button. prompt("text") The method displays a dialog box that prompts the user for input.
  • 6. Visual Studio code • Visual Studio Code (VS code) is a streamlined code editor with support for development operations like debugging, task running, and version control. • It aims to provide just the tools a developer needs for a quick code-build-debug cycle and leaves more complex workflows to fuller featured IDEs, such as Visual Studio IDE. • It is not a language-specific IDE as you can use this to write code in C#, C++, VB(Visual Basic), Python, JavaScript, and many more languages. 6
  • 7. Installation of VS code • Download and install VS code from: https://code.visualstudio.com/ 7
  • 9. Live server 9 ▪ Makes the existing server, live - this is a Web Extension that helps you to live reload feature for dynamic content. ▪ Install live server from the VS code extension tab located in the left sidebar.
  • 10. Introduction to HTML and CSS • Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. • Cascading Style Sheets (CSS) is a style sheet language used for specifying the presentation and styling of a document. 10
  • 12. Link JS and CSS with html 12 ❑At the end of html head tag to add CSS file of name style.css write: <link rel="stylesheet" href="style.css"> ❑At the end of html body tag to add CSS file of name app.js write: <script src="myscripts.js"></script>
  • 13. Link JS and CSS with html 13 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="style.css"> </head> <body> <script src="myscripts.js"></script> </body> </html>
  • 14. Example 1 14 Write a program to link html, CSS and JS files, text in JS and display in the browser.
  • 15. Example 1 15 1. Program to link CSS and JS files with html and write text in JS and display in the browser. Google drive link: https://drive.google.com/drive/folders/1pJ1_qHQPtkipWD sYwrWvCy5EZVRMuaCi?usp=drive_link Git-hub link: https://github.com/sauravbarua02/introSpring25
  • 16. Html codes 16 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial- scale=1.0"> <title>Text Display</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container" id="container"> </div> <script src="app.js"></script> </body> </html>
  • 17. CSS codes 17 body{ background-color: rgba(216, 119, 119, 0.3); } .container{ background-color: rgba(216, 119, 119, 0.6); height: 400px; width: 300px; margin:5px auto; padding: 5px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
  • 18. JS codes 18 const containerEl = document.getElementById("container"); containerEl.innerText = `Branches of Civil Engineering are- Sturctural Engineering, Geotechnical Engineering Transportation Engineering Environmental Engineering Water resource Engineering`;
  • 19. Class tasks 19 Task 1.1: Program to link CSS and JS files with html, make background color blue, write text (regarding application of Structural Engineering) in JS and display in the browser. Task 1.2: Program to link CSS and JS files with html, make background color purple, write text (regarding application of Environmental Engineering) in JS and display in the browser. Task 1.3: Program to link CSS and JS files with html, make background color yellow, write text (regarding application of Geotechnical Engineering) in JS and display in the browser. Task 1.4: Program to link CSS and JS files with html, make background color brown, write text (regarding application of Transportation Engineering) in JS and display in the browser. Task 1.5: Program to link CSS and JS files with html, make background color red, write text (regarding application of Water Resource Engineering) in JS and display in the browser. (hints: change background-color property in css and text inside backtick in JS.)
  • 20. End of the Lecture 20