forked from kanemura1206/maspen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_form.js
48 lines (47 loc) · 1.42 KB
/
mod_form.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
//<!--
//<![CDATA[
function getObjValue(obj) {
var v = ''; // the value
var t = (obj && obj.type) ? obj.type : "";
if (t=="text" || t=="textarea" || t=="hidden") {
v = obj.value;
} else if (t=="select-one" || t=="select-multiple") {
var l = obj.options.length;
for (var i=0; i<l; i++) {
if (obj.options[i].selected) {
v += (v=="" ? "" : ",") + obj.options[i].value;
}
}
}
return v;
}
function getDir(s) {
if (s.substring(0,7)=='http://' || s.substring(0,8)=='https://') {
return '';
}
if (s.charAt(0) != '/') {
s = '/' + s;
}
return s.substring(0, s.lastIndexOf('/'));
}
function AddWhiteSpace(BeforeOrAfter, id) {
if (document.getElementById) {
// locate the DIV object (class="fitem") containing the target element
var obj = document.getElementById(id);
while (obj && !(obj.className && (obj.className=='fitem' || obj.className.substring(0,6)=='fitem '))) {
obj = obj.parentNode;
}
if (obj) {
switch (BeforeOrAfter) {
case 'before': obj.style.marginTop = '1.8em'; break;
case 'after': obj.style.marginBottom = '0.8em'; break;
}
}
}
}
AddWhiteSpace('after', 'id_name');
AddWhiteSpace('before', 'id_quizchain');
AddWhiteSpace('before', 'id_password');
AddWhiteSpace('before', 'id_review');
//]]>
//-->