-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.js
43 lines (31 loc) · 1.05 KB
/
upload.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
function uploadPicture() {
document.getElementById("pictureInput").click();
}
document.getElementById("pictureInput").addEventListener("change", function() {
const file = this.files[0];
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function () {
const img = new Image();
img.src = reader.result;
document.body.appendChild(img);
};
});
function popup() {
// Create a popup window
var popupWindow = window.open('', 'Popup Window', 'width=200,height=200');
// Create a form inside the popup window
var form = document.createElement('form');
popupWindow.document.body.appendChild(form);
// Create a text input field inside the form
var input = document.createElement('input');
input.type = 'float';
input.name = 'userInput';
form.appendChild(input);
// Create a submit button inside the form
var submit = document.createElement('input');
submit.type = 'submit';
submit.value = 'Submit';
form.appendChild(submit);
}
// Add an event listener to the button