forked from Min-swo/EveryPhone.html
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
61 lines (55 loc) · 2.02 KB
/
index.html
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
<header>
<link rel = "stylesheet" type="text/css" href="index.css">
<div class = "wrapper">
<h1>EVERYPHONE</h1>
</div>
</header>
<body>
<img src="apple.png" class="img-thumbnail" alt="Apple" width="150">
<div class="outer" >
<div class="inner">
<input type="text" id="keyword" placeholder="type your model">
</div>
<div class="inner">
<button onclick="direction()">search</button>
</div>
</div>
<div class="outer2" >
<div class="inner">
<button onclick="location.href='AppleSpec.html'">Apple</button>
</div>
<div class="inner">
<button onclick="location.href='SamsungSpec.html'">Samsung</button>
</div>
</div>
<div id="toast"></div>
<script>
function direction() {
let keyword = document.getElementById('keyword').value;
let lowerkeyword = keyword.toLowerCase();
let trimkeyword = lowerkeyword.replace(" ","");
let removeToast;
console.log(trimkeyword);
let link;
if(trimkeyword.indexOf("iphone") !== -1)
{
link = 'AppleSpec.html#' + trimkeyword;
location.href = link;
}
else if(trimkeyword.indexOf("galaxy") !== -1)
{
link = 'SamsungSpec.html#' + trimkeyword;
location.href = link;
}
else
{
const toast = document.getElementById("toast");
toast.classList.contains("reveal") ?
(clearTimeout(removeToast),
removeToast = setTimeout(function () { document.getElementById("toast").classList.remove("reveal")}, 1000)) :
removeToast = setTimeout(function () {document.getElementById("toast").classList.remove("reveal") }, 1000)
toast.classList.add("reveal"), toast.innerText = "기종을 찾을 수 없습니다."
}
}
</script>
</body>