-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator_form_script.js
102 lines (92 loc) · 4.07 KB
/
generator_form_script.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
function formActivate(check, form){
let j = document.getElementsByClassName(form).length;
for(let i = 0; i < j; i++){
if(document.getElementsByName(check)[0].checked == false){
document.getElementsByClassName(form)[i].disabled = "disabled";
}else{
document.getElementsByClassName(form)[i].disabled = null;
}
}
}
function formUntick(check, form){
let j = document.getElementsByClassName(form).length;
for(let i = 0; i < j; i++){
if(document.getElementsByName(check)[0].checked == false){
document.getElementsByClassName(form)[i].checked = false;
}
}
}
function formInactivate(check, form){
let j = document.getElementsByClassName(form).length;
for(let i = 0; i < j; i++){
if(document.getElementsByName(check)[0].checked == false){
document.getElementsByClassName(form)[i].disabled = null;
}else{
document.getElementsByClassName(form)[i].disabled = "disabled";
}
}
}
function toggleDisplayOnCheck(check, targetElmId){
if(document.getElementsByName(check)[0].checked == false){
document.getElementById(targetElmId).style.display = "none";
}else{
document.getElementById(targetElmId).style.display = "block";
}
}
function toggleDisplayByValue( selectElmName, targetElmId ){
if(document.getElementsByName(selectElmName)[0].value == "notuse"){
document.getElementById(targetElmId).style.display = "none";
document.getElementById("ad_tag").value = "";
}else{
document.getElementById(targetElmId).style.display = "block";
}
}
function formNodisplay(check, targetElmId){
if(document.getElementsByName(check)[0].checked == false){
document.getElementById(targetElmId).style.display = "block";
}else{
document.getElementById(targetElmId).style.display = "none";
}
}
function formDoubleDisplay(checkA, checkB, targetElmId){
if(document.getElementsByName(checkA)[0].checked == false && document.getElementsByName(checkB)[0].checked == false){
document.getElementById(targetElmId).style.display = "none";
}else{
document.getElementById(targetElmId).style.display = "block";
}
}
/*function switchActivate(check, form, inactive){
formActivate(check, form);
let j = document.getElementsByClassName(inactive).length;
for(let i = 0; i < j; i++){
if(document.getElementsByName(check)[0].checked == true){
document.getElementsByClassName(inactive)[i].disabled = "disabled";
}
}*/
function selecterActivate(check, form){
if(document.getElementsByName(check)[0].checked == false){
document.getElementsByName(form)[0].disabled = null;
document.getElementsByName(form)[0].selected = "selected";
}else{
document.getElementsByName(form)[0].disabled = "disabled";
document.getElementsByName(form)[0].selected = null;
}
}
function selecterInactivate(check, form){
if(document.getElementsByName(check)[0].checked == false){
document.getElementsByName(form)[0].disabled = "disabled";
document.getElementsByName(form)[0].selected = null;
}else{
document.getElementsByName(form)[0].disabled = null;
document.getElementsByName(form)[0].selected = "selected";
}
}
function selecterDoubleInactivate(checkA, checkB, form){
if(document.getElementsByName(checkA)[0].checked == false && document.getElementsByName(checkB)[0].checked == false){
document.getElementsByName(form)[0].disabled = "disabled";
document.getElementsByName(form)[0].selected = null;
}else{
document.getElementsByName(form)[0].disabled = null;
document.getElementsByName(form)[0].selected = "selected";
}
}