-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
72 lines (59 loc) · 997 Bytes
/
test.js
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
/**
* Created by Paul Normington on 24/06/2015.
*/
var str = "Hello there!";
var images = [];
var printedImages = [];
var currentPic;
var j = 0;
var i = 0;
function show_image(src, width, height, alt) {
var img = document.createElement("img");
img.src = src;
img.width = width;
img.height = height;
img.alt = alt;
// This next line will just add it to the <body> tag
document.body.appendChild(img);
printedImages.push(img);
}
function set_images()
{
images.push('happy.jpg', 'happy1.jpg', 'happy2.jpg');
}
function getImgs()
{
return printedImages;
}
function delete_image()
{
var currentPic = getImgs();
j = currentPic.length;
document.body.removeChild(currentPic[j-1]);
currentPic.pop();
}
function change_image()
{
if(i >= 2)
{
i = 0;
}
else
{
i++;
}
}
function get_images()
{
return images;
}
function getCount()
{
return i;
}
function print_images()
{
console.log(images[i]);
console.log(printedImages);
console.log(i);
}