Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions harmandeep-singh/day 1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task | Swiggy Day 1</title>

<script>
function display1() {
document.getElementById('div4').innerHTML = 'How are you?';
}

function display3() {
var name = document.getElementById('in1').value;
document.write('Thanks for Filling out the info ' + name);
}
</script>
<!-- Extenal Script -->
<script src="./js/script.js"></script>
</head>

<body>
<!-- Inline script implementation -->
<h3>Inline Script Implementation</h3>
<br>
<div id="div1" onmouseover="document.getElementById('div2').innerHTML='How are you?'">
Hey There! Hover over me!
<div id="div2"></div>
</div>
<hr>

<!-- Internal script implementation -->
<h3>Internal Script Implementation</h3>
<br>
<div id="div3" onmouseover="display1()">
I'm implemented using Internal Script! But you can still Hover over me!
<div id="div4"></div>
</div>
<hr>

<!-- External script implementation -->
<h3>External Script Implementation</h3>
<br>
<div id="div3">
<label for="in1">Enter you name</label> <br>
<input type="text" id="in1" placeholder="Jon Doe" onblur="greet(this.value);">
<br><br>
<button onclick="display3(); display2();">Submit</button>
<button onclick="print()">Print</button>
</div>
<hr>
</body>

</html>
7 changes: 7 additions & 0 deletions harmandeep-singh/day 1/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function display2(data) {
console.log('Display 2 called with ' + data);
}

function greet(name) {
alert('Nice to meet you ' + name);
}
35 changes: 35 additions & 0 deletions harmandeep-singh/day 2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task | Swiggy Day 2</title>

<script src="./js/script.js"></script>
</head>

<body>
<h1>Task | Swiggy Day 2</h1>
<hr>

<section id="hero">
<span>Good Morning</span>
<h3 id="heading" style="font-size: 30px;"> Hello <span id="name">World</span>! How are you?</h3>
</section>

<label for="in1">Enter your name: </label>
<input type="text" id="in1">
<button onclick="updateName()">Update Name</button>

<br> <br>
<hr>

<button onclick="toggleFontSize()">Change Font Size</button>
<button onclick="toggleDisplay()">Change Display property</button>
<button onclick="toggleVisibility()">Change Visibility property</button>

</body>

</html>
45 changes: 45 additions & 0 deletions harmandeep-singh/day 2/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const fontChoices = ["30px", "40px", "50px", "60px", "70px", "80px", "90px", "100px"];
const displayChoices = ["block", "inline", "none"];
const visibiltyChoices = ["visible", "hidden"];

function updateName() {
let name = document.getElementById("in1").value;
document.getElementById("name").innerHTML = name;
}

function toggleFontSize() {
let name = document.getElementById("heading");
let current = name.style.fontSize;
let index = fontChoices.indexOf(current);
if (index < fontChoices.length - 1) {
index++;
}
else {
index = 0;
}
name.style.fontSize = fontChoices[index];
}
function toggleDisplay() {
let name = document.getElementById("heading");
let current = name.style.display;
let index = displayChoices.indexOf(current);
if (index < displayChoices.length - 1) {
index++;
}
else {
index = 0;
}
name.style.display = displayChoices[index];
}
function toggleVisibility() {
let name = document.getElementById("heading");
let current = name.style.visibility;
let index = visibiltyChoices.indexOf(current);
if (index < visibiltyChoices.length - 1) {
index++;
}
else {
index = 0;
}
name.style.visibility = visibiltyChoices[index];
}
16 changes: 16 additions & 0 deletions harmandeep-singh/day 3/Files/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Demo Document</title>
</head>

<body>
<h1>Header</h1>
<p>This is a paragraph.</p>
</body>

</html>
2 changes: 2 additions & 0 deletions harmandeep-singh/day 3/Files/demo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hello world How are you?
This is i++ bootcamp.
20 changes: 20 additions & 0 deletions harmandeep-singh/day 3/fsCreateFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var fs = require('fs');

fs.appendFile('newfile.txt', 'Hello World!', function (err) {
if (err) throw err;
console.log('Saved!');
});

fs.writeFile('newfile1.txt', 'Hello World!', function (err) {
if (err) throw err;
console.log('Saved!');
});

fs.open('newfile2.txt', 'w', function (err, file) {
if (err) return err;
console.log('File opened successfully.');
fs.writeFile(file, 'New data added', function (err) {
if (err) throw err;
console.log('Data written successfully.');
});
})
15 changes: 15 additions & 0 deletions harmandeep-singh/day 3/fsDeleteFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var fs = require('fs');

fs.open('dummyFile.txt', 'w', function (err, file) {
if (err) {
throw err;
}
console.log('File opened successfully.');
});

fs.unlink('dummyFile.txt', function (err) {
if (err) {
throw err;
}
console.log('File deleted successfully.');
});
13 changes: 13 additions & 0 deletions harmandeep-singh/day 3/fsReadFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var http = require('http');
var fs = require('fs');

http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/html' });
fs.readFile('./Files/demo.html', function (err, data) {
if (err) {
throw err;
}
res.write(data);
res.end();
})
}).listen(8080);
6 changes: 6 additions & 0 deletions harmandeep-singh/day 3/fsUpdateFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var fs = require('fs');

fs.appendFile('./Files/demo.txt', 'This is i++ bootcamp.\n', function (err) {
if (err) throw err;
console.log('Updated!');
});
7 changes: 7 additions & 0 deletions harmandeep-singh/day 3/serverTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var http = require('http');

http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write('<H1> Swiggy task 3</h1>');
res.end('Hello World!');
}).listen(8080);