-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindPetsJs.js
64 lines (40 loc) · 1.79 KB
/
findPetsJs.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
document.addEventListener("DOMContentLoaded", function () {
function getCurrentDate(){
const date = new Date();
let day = date.getDate();
let month = date.getMonth() + 1;
let year = date.getFullYear();
let currentDate = `${day}-${month}-${year}`;
const time = new Date();
let hour =time.getHours();
let minute =time.getMinutes();
let second = time.getSeconds();
let currentTime = `${hour}:${minute}:${second}`;
let dateAndTime = "Date:" + currentDate + "<br>Time: "+currentTime;
return dateAndTime;
}
setInterval(function() {
document.getElementById("time").innerHTML= getCurrentDate();
}, 1000);
window.Validate = function() {
var error = false;
var animal = document.getElementById("animal");
var breed = document.getElementById("breed");
var animalAge = document.getElementById("animalAge");
var animalGender = document.getElementById("animalGender");
if (animal.value == ""||breed.value =="" || animalAge.value =="" ||animalGender.value =="" ) {
error = true;
if(document.getElementById("Dogs3").checked === false && document.getElementById("Cats3").checked === false && document.getElementById("SmallChildren").checked === false){
error= true;
if (!pattern.test(OwnerEmail.value)) {
alert("Please do not leave fields empty.Please enter a valid email address.");
return false;
}
else{
alert("Please do notleave fields empty.");
return false;
}
}
return true;
}
});