Skip to content

Commit e01eda5

Browse files
author
Tray2
committed
Added alt as an optional third parameter to setImgSrc, and added examples/updateimagesource.html
1 parent fcf87f5 commit e01eda5

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

examples/images/example1.jpg

96.7 KB
Loading

examples/images/example2.jpg

129 KB
Loading

examples/updateimagesource.html

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
<style>
9+
body {
10+
padding: 10px;
11+
background-color: azure;
12+
border: 1px solid #888;
13+
border-radius: 5px;
14+
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
15+
}
16+
17+
</style>
18+
</head>
19+
<body>
20+
<h1>Update Image Source</h1>
21+
<ul>
22+
<li>Example image one, by <a href="https://unsplash.com/@pandales">Frank Ching</a></li>
23+
<li>Example image two, by <a href="https://unsplash.com/@samusevych">Sasha Samusevych</a></li>
24+
</ul>
25+
26+
<button onclick="updateImageSource()">Update Image</button>
27+
<img src="./images/example1.jpg" alt="example image 1">
28+
<script src="./../helper.js"></script>
29+
30+
<script>
31+
function updateImageSource() {
32+
setImgSrc('img', './images/example2.jpg', 'Changed to example image 2');
33+
}
34+
</script>
35+
</body>
36+
</html>

0 commit comments

Comments
 (0)