Skip to content

Commit c3d114e

Browse files
authored
Add files via upload
1 parent d8c1483 commit c3d114e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+973
-0
lines changed

Diff for: Assignment1/Q1.html

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Q1</title>
7+
</head>
8+
<body>
9+
<script>
10+
var student = {
11+
name: "David Rayy",
12+
sclass: "VI",
13+
rollno: 12
14+
};
15+
16+
var details = Object.keys(student)
17+
18+
document.write(details);
19+
20+
</script>
21+
</body>
22+
</html>

Diff for: Assignment1/Q2.html

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Q2</title>
7+
</head>
8+
<body>
9+
<script>
10+
var student = {
11+
name: "David Rayy",
12+
sclass: "VI",
13+
rollno: 12
14+
};
15+
16+
document.writeln("Object before deleting rollno property:<br>");
17+
document.writeln("Name :"+student.name);
18+
document.writeln("sclass :"+student.sclass);
19+
document.writeln("rollno :"+student.rollno +"<br>");
20+
21+
delete student.rollno;
22+
23+
document.writeln("Object after deleting rollno property:<br>");
24+
document.writeln("Name :"+student.name);
25+
document.writeln("sclass :"+student.sclass);
26+
document.writeln("rollno :"+student.rollno);
27+
</script>
28+
29+
</body>
30+
</html>

Diff for: Assignment1/Q3.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Q3</title>
7+
</head>
8+
<body>
9+
<script>
10+
var student = {
11+
name: "David Rayy",
12+
sclass: "VI",
13+
rollno: 12
14+
};
15+
16+
document.writeln("Name :"+student.name);
17+
document.writeln("sclass :"+student.sclass);
18+
document.writeln("rollno :"+student.rollno +"<br>");
19+
20+
document.writeln("The length of the object is : ")
21+
document.writeln(Object.keys(student).length)
22+
</script>
23+
24+
</body>
25+
</html>

Diff for: Assignment1/Q4.html

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Q4</title>
7+
</head>
8+
<body>
9+
<script>
10+
var library = [
11+
{
12+
author: 'Bill Gates',
13+
title: 'The Road Ahead',
14+
readingStatus: true
15+
},
16+
{
17+
author: 'Steve Jobs',
18+
title: 'Walter Isaacson',
19+
readingStatus: true
20+
},
21+
{
22+
author: 'Suzanne Collins',
23+
title: 'Mockingjay: The Final Book of The Hunger Games',
24+
readingStatus: false
25+
}
26+
];
27+
28+
for (var i = 0; i < library.length; i++) {
29+
var book = library[i];
30+
if(book.readingStatus){
31+
book.readingStatus="Already Read ";
32+
}
33+
else{
34+
book.readingStatus="Did not read";
35+
}
36+
document.write("Book: " + book.title + " by " + book.author + ", Status: " + book.readingStatus +"<br>")
37+
}
38+
</script>
39+
</body>
40+
</html>

Diff for: Assignment1/Q5.html

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Q5</title>
7+
</head>
8+
<body>
9+
<script>
10+
11+
function cylinder(radius ,height){
12+
this.radius = r;
13+
this.height = h;
14+
15+
var volume = Math.PI * radius*radius*height
16+
return volume
17+
}
18+
19+
var r =window.prompt("Enter the Radius")
20+
var h =window.prompt("Enter the height")
21+
22+
document.writeln("Radius : "+r+"<br>")
23+
document.writeln("Height : "+h+"<br>")
24+
document.writeln("The Volume of the cylinder is : ")
25+
document.writeln(cylinder(r,h))
26+
27+
</script>
28+
29+
</body>
30+
</html>

Diff for: Assignment1/Q6.html

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Q6</title>
7+
</head>
8+
<body>
9+
<script>
10+
function bubbleSort(arr) {
11+
var len = arr.length;
12+
for (var i = 0; i < len - 1; i++) {
13+
for (var j = 0; j < len - 1 - i; j++) {
14+
if (arr[j] > arr[j + 1]) {
15+
// Swap elements if they are in the wrong order
16+
var temp = arr[j];
17+
arr[j] = arr[j + 1];
18+
arr[j + 1] = temp;
19+
}
20+
}
21+
}
22+
return arr;
23+
}
24+
25+
var sampleData = [6, 4, 0, 3, -2, 1];
26+
document.writeln("Sample Data:", sampleData);
27+
document.writeln("<br>");
28+
document.write("Sorted Output:", bubbleSort(sampleData));
29+
</script>
30+
</body>
31+
</html>

Diff for: Assignment1/Q7.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Q7</title>
7+
</head>
8+
<body>
9+
<script>
10+
var s = "dog";
11+
var l =[];
12+
for(var i=0;i<s.length;i++){
13+
for(var j=0;j<=s.length;j++){
14+
var r =s.substring(j,i)
15+
if(l.includes(r)==false && r!=''){
16+
l.push(s.substring(j,i));
17+
}
18+
}
19+
}
20+
21+
document.write(l)
22+
23+
</script>
24+
</body>
25+
</html>

Diff for: Assignment1/simply.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
s="dog"
2+
l=[]
3+
for i in range(len(s)):
4+
for j in range(len(s)):
5+
r=s[i:j+1]
6+
if r=='':
7+
pass
8+
else:
9+
l.append(s[i:j+1])
10+
11+
print(l)

Diff for: Form Validation/CheckValidityjs.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
<html>
3+
<body>
4+
<p>Enter a number and click OK:</p>
5+
<input id="id1" type="number" min="100" max="300" required>
6+
<button onclick="myFunction()">OK</button>
7+
<p>If the number is less than 100 or greater than 300, an error message will be displayed.</p>
8+
<p id="demo"></p>
9+
<script>
10+
function myFunction() {
11+
var inpObj = document.getElementById("id1");
12+
if (!inpObj.checkValidity()) {
13+
document.getElementById("demo").innerHTML = inpObj.validationMessage; /*This .validationMessage automatically send error message*/
14+
} else {
15+
document.getElementById("demo").innerHTML = "Input OK";
16+
}
17+
}
18+
</script>
19+
</body>
20+
</html>
21+
22+
23+

Diff for: Form Validation/EmailValidationjs.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<html>
2+
<head>
3+
<script>
4+
function validate()
5+
{
6+
var emailID = document.myform.email.value;
7+
atpos = emailID.indexOf("@");
8+
dotpos = emailID.lastIndexOf(".");
9+
if (atpos < 1 || ( (dotpos - atpos) < 2 )) {
10+
alert("Please enter correct email ID")
11+
}
12+
}
13+
</script>
14+
</head>
15+
<body>
16+
<form name="myform" onsubmit="validate()">
17+
<input type="text" name="email">
18+
<input type="submit" value="Submit">
19+
</form>
20+
</body>
21+
</html>

Diff for: Form Validation/NumberValidationjs.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<html>
2+
<body>
3+
<h2>JavaScript Can Validate Input</h2>
4+
<p>Please input a number between 1 and 10:</p>
5+
<input id="numb">
6+
<button type="button" onclick="myFunction()">Submit</button>
7+
<p id="demo">Result</p>
8+
<script>
9+
function myFunction() {
10+
var x, text;
11+
// Get the value of the input field with id="numb"
12+
x = document.getElementById("numb").value;
13+
// If x is Not a Number or less than one or greater than 10
14+
if (isNaN(x) || x < 1 || x > 10) {
15+
text = "Input not valid";
16+
} else {
17+
text = "Input OK";
18+
}
19+
document.getElementById("demo").innerHTML = text;
20+
}
21+
</script>
22+
</body>
23+
</html>

Diff for: Form Validation/RangeOverflowjs.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<html>
2+
<body>
3+
<p>Enter a number and click OK:</p>
4+
<input id="id1" type="number" max="100">
5+
<button onclick="myFunction()">OK</button>
6+
<p>If the number is greater than 100 (the input's max attribute), an error message will be displayed.</p>
7+
<p id="demo"></p>
8+
<script>
9+
function myFunction() {
10+
var txt = "";
11+
if (document.getElementById("id1").validity.rangeOverflow) {
12+
txt = "Value too Big";
13+
} else {
14+
txt = "Input OK";
15+
}
16+
document.getElementById("demo").innerHTML = txt;
17+
}
18+
</script>
19+
</body>
20+
</html>

Diff for: Form Validation/RangeUnderflowjs.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<html>
2+
<body>
3+
<p>Enter a number and click OK:</p>
4+
<input id="id1" type="number" min="100">
5+
<button onclick="myFunction()">OK</button>
6+
<p>If the number is less than 100 (the input's min attribute), an error message will be displayed.</p>
7+
<p id="demo"></p>
8+
<script>
9+
function myFunction() {
10+
var txt = "";
11+
if (document.getElementById("id1").validity.rangeUnderflow) {
12+
txt = "Value too small";
13+
} else {
14+
txt = "Input OK";
15+
}
16+
document.getElementById("demo").innerHTML = txt;
17+
}
18+
</script>
19+
</body>
20+
</html>

0 commit comments

Comments
 (0)