-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.js
More file actions
36 lines (28 loc) · 1.29 KB
/
functions.js
File metadata and controls
36 lines (28 loc) · 1.29 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
//Pratice 2: function for setting the paragraph and the border color.
function alert_paragraph_color() {
var border_R = document.getElementById("border_R").value;
var border_G = document.getElementById("border_G").value;
var border_B = document.getElementById("border_B").value;
var border_width = document.getElementById("border_width").value;
var bg_R = document.getElementById("bg_R").value;
var bg_G = document.getElementById("bg_G").value;
var bg_B = document.getElementById("bg_B").value;
var tag = document.getElementById("paragraph");
tag.style.borderColor = `rgb(${border_R},${border_G},${border_B})`;
tag.style.borderWidth = border_width
tag.style.backgroundColor = `rgb(${bg_R},${bg_G},${bg_B})`;
}
//Practice 3: function for checking whether the password is validated
function validate() {
var pass1 = document.getElementById("password1").value;
var pass2 = document.getElementById("password2").value;
if (pass1.length < 8) {
alert("The length of the first password is less than 8 letters!")
} else if (pass2.length < 8) {
alert("The length of the second password is less than 8 letters!")
} else if (pass1 != pass2) {
alert("Two passwords don't match!")
} else {
alert("Everything is good!")
}
}