forked from coder2hacker/Explore-open-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOOP.txt
47 lines (40 loc) · 1.42 KB
/
OOP.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!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>::: OOP :::</title>
<script>
function student(){
this.StudentName;
this.PhoneNumber;
this.Insert = function(){
var StudentDetails = this.StudentName +', '+this.PhoneNumber;
return StudentDetails + ' has been saved...';
}
}
function StudentEnrollment()
{
var aStudent = new student();
aStudent.StudentName = "Sourav";
aStudent.PhoneNumber = "987456"
alert(aStudent.StudentName+' '+ aStudent.PhoneNumber);
alert(aStudent.Insert());
// var anotherStudent = new student();
// anotherStudent.StudentName = "Sujoy";
// anotherStudent.PhoneNumber = "897878787"
// alert(anotherStudent.StudentName+' '+ anotherStudent.PhoneNumber);
// aStudent.PhoneNumber="78898954";
// alert(aStudent.StudentName+' '+ aStudent.PhoneNumber);
}
</script>
</head>
<body>s
<H1>
Object Orientation in JavaScript
</H1>
<hr/>
<input type="button" value="Student" onclick="StudentEnrollment()"/>
</body>
</html>