-
Notifications
You must be signed in to change notification settings - Fork 244
/
join.js
70 lines (67 loc) · 2.16 KB
/
join.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
66
67
68
69
70
var joinForm;
var joinClick = function () {
$s("join").blur();
if ( joinForm.validateForm() ) {
// alerts are not read with ChromeVox, so hide for this exercise.
// alert("Please correct the errors on the page.");
} else {
document.location.href = '#top';
$s("feedback").focus();
//window.setTimeout( function(){
// window.location.href="login.html?login="+$s("username").value+"&password="+$s("password").value;
// },5000
//);
}
}
var resetClick = function () {
$s("reset_form").blur();
$s("join_form").reset();
$s("feedback").style.display = "none";
joinForm.resetErrors();
}
// Toggle between province/post and state/zip fields
var setCountry = function(){
if($s("country").value == "usa"){
hideBlock("prov_block");
showBlock("state_block");
$s("province").value = "";
$s("postal").value = "";
}else if($s("country").value == "ca"){
hideBlock("state_block");
showBlock("prov_block")
$s("state").value = "";
$s("zip").value = "";
}
}
var hideBlock = function(className){
var elements = document.getElementsByClassName(className);
for(var i = 0, length = elements.length; i < length; i++) {
elements[i].style.display = 'none';
}
}
var showBlock = function(className){
var elements = document.getElementsByClassName(className);
for(var i = 0, length = elements.length; i < length; i++) {
elements[i].style.display = 'inline';
}
}
window.onload = function () {
if($s("country").value == ''){
$s("country").value = "usa";
}
setCountry();
joinForm = new JoinForm();
joinForm.setMessages();
$s("country").onchange = setCountry;
$s("join").onclick = joinClick;
$s("reset_form").onclick = resetClick;
var a = document.getElementsByClassName("fake");
for(i=0 ; i<a.length ; i++){
a[i].addEventListener('click', function(e) {
if (this.href === window.location.href) {
e.preventDefault();
alert("fake link");
}
});
}
}