-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlaceholder_Image_Generator.html
More file actions
70 lines (64 loc) · 2.65 KB
/
Placeholder_Image_Generator.html
File metadata and controls
70 lines (64 loc) · 2.65 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>🏴‍☠️ Complete Javascripts Course</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous" />
</head>
<body>
<br />
<br />
<br />
<br />
<br />
<center>
<!-- <input type="text" id="item"> -->
<br />
<div id="wrapper">📃 🏪 😆</div>
<br />
<form>
<select onchange="imgU()">
<option value="">Select</option>
<option value="150x150">Small</option>
<option value="350x150">Medium</option>
<option value="750x150">Large</option>
</select>
<br><br>
Add Text
<input type="text" onchange="imgU()">
<br><br>
Select Color
<input type="color" onchange="imgU()">
<br> <br> <img src="http://via.placeholder.com/350x150/222/fff?text=Image1" id="myImage"> </form>
<script>
var iColor = "222";
var iText = "Image1";
var iSize = "350x150";
function imgU() {
console.dir(event.target);
console.dir(event.target.value);
console.log(event.target.parentElement.myImage.src)
if (event.target.type == "select-one") {
iSize = event.target.value;
} else if (event.target.type == "text") {
iText = event.target.value;
} else if (event.target.type == "color") {
var nColor = event.target.value;
iColor = nColor.replace("#", "");
}
var imsrc = "http://via.placeholder.com/" + iSize + "/" + iColor + "/fff?text=" + iText;
message(imsrc);
event.target.parentElement.myImage.src = imsrc;
}
function message(m) {
document.getElementById('wrapper').innerHTML = m;
}
</script>
<script src="https://code.jquery.com/jquery-3.5.0.js"
integrity="sha256-r/AaFHrszJtwpe+tHyNi/XCfMxYpbsRg2Uqn0x3s2zc=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
</body>
</html>