-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththirteen.html
More file actions
115 lines (103 loc) · 3.16 KB
/
Copy paththirteen.html
File metadata and controls
115 lines (103 loc) · 3.16 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<style>
div {
width: 100px;
height: 100px;
border: 3px solid black;
}
</style>
<script>
<!-- var txt = "my long string"; -->
<!-- var num = 5; -->
<!-- var index = txt.indexOf("long",0); -->
<!-- alert('Index of ' + index); -->
<!-- var exp = num.toExponential(2); -->
<!-- alert('Exponential ' + exp); -->
<!-- var txt = new String("Oscar Ortiz"); -->
<!-- var num = new Number(2); -->
<!-- alert('txt ' + txt); -->
<!-- alert('num ' + num); -->
<!-- var book = { -->
<!-- ISBN: "55555555", -->
<!-- Length: 560, -->
<!-- genre: "programming", -->
<!-- covering: "soft", -->
<!-- author: "John Doe", -->
<!-- currentPage: 5, -->
<!-- title: "My Big Book of Wonderful Things", -->
<!-- flipTo: function flipToAPage(pNum) { -->
<!-- this.currentPage = pNum; -->
<!-- }, -->
<!-- turnPageForward: function turnForward() { -->
<!-- this.flipTo(this.currentPage++); -->
<!-- }, -->
<!-- turnPageBackward: function turnBackward() { -->
<!-- this.flipTo(this.currentPage--); -->
<!-- } -->
<!-- } -->
<!-- <!-- alert('book ' + book); --> -->
<!-- <!-- alert('book ' + book.author); --> -->
<!-- //This line throws an exception because the object does not support this method -->
<!-- book.FlipToAPage(15); -->
<!-- //alert('book ' + book.FlipToAPage(15)); -->
<!-- //This line works because this is what the method has been named. -->
<!-- book.flipTo(15); -->
<!-- //alert('book ' + book.flipTo(15)); -->
<!-- function Book() { -->
<!-- this.ISBN = "55555555"; -->
<!-- this.Length = 560; -->
<!-- this.genre= "programming"; -->
<!-- this.covering = "soft"; -->
<!-- this.author = "John Doe"; -->
<!-- this.currentPage = 5, -->
<!-- this.flipTo = function FlipToAPage(pNum) { -->
<!-- this.currentPage = pNum; -->
<!-- }, -->
<!-- this.turnPageForward = function turnForward() { -->
<!-- this.flipTo(this.currentPage++); -->
<!-- }, -->
<!-- this.turnPageBackward = function turnBackward() { -->
<!-- this.flipTo(this.currentPage--); -->
<!-- } -->
<!-- } -->
<!-- var books = new Array(new Book(), new Book(), new Book()); -->
<!-- books[0].Length -->
<!-- var book = { ISBN: "55555555", Length: 560, genre: "programming", covering: "soft", author: "John Doe", currentPage: 5, title: "My Big Book of Wonderful Things", flipTo: function flipToAPage(pNum) {this.currentPage = pNum; }, turnPageForward: function turnForward() { this.flipTo(this.currentPage++); }, turnPageBackward: function turnBackward() { this.flipTo(this.currentPage--); } } -->
function Book()
{
//just creates an empty book.
}
function Book(title, length, author) {
this.title = title;
this.Length = length;
this.author = author;
}
Book.prototype = {
ISBN: "",
Length: -1,
genre: "",
covering: "",
author: "",
currentPage: 0,
title: "",
flipTo: function FlipToAPage(pNum) {
this.currentPage = pNum;
},
turnPageForward: function turnForward() {
this.flipTo(this.currentPage++);
},
turnPageBackward: function turnBackward() {
this.flipTo(this.currentPage--);
}
};
var books = new Array(new Book(), new Book("First Edition",350,"Random"));
</script>
</head>
<body>
<div id="Div1">DIV 1</div>
<div id="Div2">DIV 2</div>
<div id="Div3">DIV 3</div>
</body>
</html>