Added LinuxChix theme
[moodle-linuxchix.git] / mod / hotpot / mod_form.js
blobe33b9483f2d75199235a6b1e7b6f7a9385c7bcff
1 //<!--
2 //<![CDATA[
4 function getObjValue(obj) {
5 var v = ''; // the value
6 var t = (obj && obj.type) ? obj.type : "";
7 if (t=="text" || t=="textarea" || t=="hidden") {
8 v = obj.value;
9 } else if (t=="select-one" || t=="select-multiple") {
10 var l = obj.options.length;
11 for (var i=0; i<l; i++) {
12 if (obj.options[i].selected) {
13 v += (v=="" ? "" : ",") + obj.options[i].value;
17 return v;
19 function getDir(s) {
20 if (s.substring(0,7)=='http://' || s.substring(0,8)=='https://') {
21 return '';
23 if (s.charAt(0) != '/') {
24 s = '/' + s;
26 return s.substring(0, s.lastIndexOf('/'));
28 function AddWhiteSpace(BeforeOrAfter, id) {
29 if (document.getElementById) {
30 // locate the DIV object (class="fitem") containing the target element
31 var obj = document.getElementById(id);
32 while (obj && !(obj.className && (obj.className=='fitem' || obj.className.substring(0,6)=='fitem '))) {
33 obj = obj.parentNode;
35 if (obj) {
36 switch (BeforeOrAfter) {
37 case 'before': obj.style.marginTop = '1.8em'; break;
38 case 'after': obj.style.marginBottom = '0.8em'; break;
43 AddWhiteSpace('after', 'id_name');
44 AddWhiteSpace('before', 'id_quizchain');
45 AddWhiteSpace('before', 'id_password');
46 AddWhiteSpace('before', 'id_review');
47 //]]>
48 //-->