-
Notifications
You must be signed in to change notification settings - Fork 0
/
reg.js
65 lines (58 loc) · 2.14 KB
/
reg.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
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
document.getElementById("prijava").onclick = function(event) {
var slanjeForme = true;
// Ime korisnika mora biti uneseno
var poljeIme = document.getElementById("ime");
var ime = document.getElementById("ime").value;
if (ime.length == 0) {
slanjeForme = false;
poljeIme.style.border="1px dashed red";
document.getElementById("porukaIme").innerHTML="<br>Unesite ime!<br>";
}
// Prezime korisnika mora biti uneseno
var poljePrezime = document.getElementById("prezime");
var prezime = document.getElementById("prezime").value;
if (prezime.length == 0) {
slanjeForme = false;
poljePrezime.style.border="1px dashed red";
document.getElementById("porukaPrezime").innerHTML="<br>Unesite prezime!<br>";
}
// Korisničko ime mora biti uneseno
var poljeUsername = document.getElementById("username");
var username = document.getElementById("username").value;
if (username.length == 0) {
slanjeForme = false;
poljeUsername.style.border="1px dashed red";
document.getElementById("porukaUsername").innerHTML="<br>Unesite korisničko ime!<br>";
}
// Provjera podudaranja lozinki
var poljePass = document.getElementById("lozinka");
var pass = document.getElementById("lozinka").value;
var poljePassRep = document.getElementById("lozinkaRep");
var passRep = document.getElementById("lozinkaRep").value;
if (pass.length == 0 || passRep.length == 0 || pass != passRep) {
slanjeForme = false;
poljePass.style.border="1px dashed red";
poljePassRep.style.border="1px dashed red";
document.getElementById("porukaPass").innerHTML="<br>Lozinke nisu iste!<br>";
document.getElementById("porukaPassRep").innerHTML="<br>Lozinke nisu iste!<br>";
}
if (slanjeForme != true) {
event.preventDefault();
}
};
function myFunction1() {
var x = document.getElementById("lozinka");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
function myFunction2() {
var x = document.getElementById("lozinkaRep");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}