-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject2.js
49 lines (38 loc) · 1.27 KB
/
project2.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
$(document).ready(function() {
// Toggle the receive spam checkbox
$("#receivespambutton").click(function() {
if($($("#receivespambutton").children()[0]).attr("src")=="pics/unchecked.png") {
$($("#receivespambutton").children()[0]).attr("src","pics/checked.png");
$("#spamyn").val("y");
} else {
$($("#receivespambutton").children()[0]).attr("src","pics/unchecked.png");
$("#spamyn").val("n");
}
});
// Play video
$("#videoplayer").mousedown(function() {
if($($("#videoplayer").children()[0]).attr("src")=="pics/play.png") {
$($("#videoplayer").children()[0]).attr("src","pics/pause.jpg");
$("#thevideo")[0].play();
} else {
$($("#videoplayer").children()[0]).attr("src","pics/play.png");
$("#thevideo")[0].pause();
}
});
// Form validation
$("#signupbutton").click(function() {
if($("#fn").val()=="" || $("#mi").val()=="" || $("#ln").val()=="") {
$("#name").addClass("error");
return;
} else {
$("#name").removeClass("error");
}
if($("#em").val()=="") {
$("#email").addClass("error");
return;
} else {
$("#name").removeClass("error");
}
alert("Thank you! Please watch your email for our exciting newsletter and offers!");
});
});