-
Notifications
You must be signed in to change notification settings - Fork 0
/
dt.js
51 lines (43 loc) · 1.25 KB
/
dt.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
var counter = 1;
var word = "150px";
var line = "80px";
var timeVar;
var mainpage = "main.html";
function begin()
{
timeVar = setInterval(function(){timer()},5000);
}
function updateTextArea(str, textType)
{
if(textType == "word")
document.getElementById("textArea").innerHTML = "<p style=\"font-size:" + word + ";margin: 0px 0px 0px 0px;\">" + str+ "</p>";
if(textType == "line")
document.getElementById("textArea").innerHTML = "<p style=\"font-size:" + line + ";margin: 0px 0px 0px 0px;\">" + str+ "</p>";
}
function updateImage(src)
{
document.getElementById("imageArea").innerHTML = "<img src=\"" + src + "\" />";
}
function redirect()
{
window.location.assign("about:blank");
}
function timer()
{
switch(counter)
{
case 1: updateTextArea("Allows single direction current flow", "line");
updateImage("img/dt/diode1.JPG");
break;
case 2: updateTextArea("Acts as short in same direction", "line");
updateImage("img/dt/diode2.JPG");
break;
case 3: updateTextArea("Acts as open in opposite direction", "line");
updateImage("img/dt/diode3.JPG");
break;
case 4: redirect();
clearTimeout(timeVar);
break;
}
counter++;
}