-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
40 lines (32 loc) · 766 Bytes
/
test.html
File metadata and controls
40 lines (32 loc) · 766 Bytes
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
<!DOCTYPE HTML>
<html>
<head>
<title>
How to create an image element
dynamically using JavaScript ?
</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body id = "body" style = "text-align:center;">
<div id="aa"></div>
<script>
$(document).ready(function(){
var dir = "img/aiml/"; // folder location
var fileextension = ".jpg"; // image format
var i = "1";
var ele="";
$(function imageloop(){
$("<img />").attr('src', dir + i + fileextension ).appendTo(".testing");
ele+='<img src="'+dir+i+fileextension+'" />';
if (i==14){
document.getElementById("aa").innerHTML = ele;
}
else{
i++;
imageloop();
};
});
});
</script>
</body>
</html>