Team:Heidelberg/Modeling/miGUI
From 2010.igem.org
(Difference between revisions)
Line 39: | Line 39: | ||
function sendall() { | function sendall() { | ||
for(var i=1;i<=12;i++) { | for(var i=1;i<=12;i++) { | ||
- | if(document.getElementById("lowerinputform"+i).style.display = " | + | if(document.getElementById("lowerinputform"+i).style.display != "") { |
readvar(i, "formout"); | readvar(i, "formout"); | ||
- | dataarray[ | + | for(var j=0;j<dataarray[i].length;j++) { |
+ | alert(dataarray[i][j]); | ||
+ | } | ||
} | } | ||
Line 58: | Line 60: | ||
} | } | ||
} | } | ||
- | + | ||
function readvar(num, target) { | function readvar(num, target) { | ||
var r = 0; | var r = 0; | ||
- | var countinput=dforms[target+num].length | + | var countinput=dforms[target+num].length; |
- | dataarray[num] = new Array( | + | dataarray[num] = new Array(); |
var dformsnr = dforms[target+num]; | var dformsnr = dforms[target+num]; | ||
Line 68: | Line 70: | ||
dformsnrelement = dformsnr.elements[i]; | dformsnrelement = dformsnr.elements[i]; | ||
- | + | switch (dformsnrelement.type) { | |
- | + | case 'radio': if (dformsnrelement.checked == true) { | |
- | + | dataarray[num].push(dformsnrelement.value); | |
- | + | } | |
- | + | else { r++ }; | |
- | + | break; | |
- | + | ||
- | + | case 'select-multiple': | |
- | + | var subarraycount = dformsnrelement.length; | |
- | + | var countentries = 0; | |
- | + | dataarray[num].push(""); | |
- | + | for (var j=0;j<subarraycount;j++){ | |
- | + | if (dformsnrelement[j].selected == true ) { | |
- | + | if (dataarray[num][i-r] == "") { | |
- | + | dataarray[num][i-r] += dformsnrelement[j].value; | |
- | + | } | |
- | + | else { dataarray[num][i-r] += ";" + dformsnrelement[j].value; | |
- | + | }; | |
- | + | } | |
+ | }; | ||
+ | break; | ||
+ | |||
+ | case 'button': break; | ||
+ | |||
+ | default: dataarray[num].push(dformsnrelement.value); | ||
+ | break; | ||
+ | |||
} | } | ||
- | |||
- | |||
- | |||
- | |||
} | } | ||
} | } | ||
- | + | ||
function writevar(num, target, scriptoutput) { | function writevar(num, target, scriptoutput) { | ||
var r = 0; | var r = 0; | ||
Line 102: | Line 108: | ||
dformsnrelement = dformsnr.elements[i]; | dformsnrelement = dformsnr.elements[i]; | ||
- | + | ||
- | + | switch (dformsnrelement.type) { | |
- | + | ||
- | + | case 'radio': if (dformsnrelement.value == dataarray[num][i-r]) { | |
- | + | dformsnrelement.checked = "checked"; | |
- | + | } | |
- | + | else { r++ }; | |
- | + | break; | |
- | + | ||
- | + | case 'select-multiple': | |
- | + | var multiples = dataarray[num][i-r].split(";"); | |
- | + | var countmulti = 0; | |
- | + | for (var j=0;j<dformsnrelement.length;j++){ | |
- | + | if (dformsnrelement[j].value == multiples[countmulti] ) { | |
- | + | dformsnrelement[j].selected = "selected"; | |
- | + | countmulti++; | |
+ | } | ||
+ | else { dformsnrelement[j].selected = false; | ||
+ | }; | ||
+ | }; | ||
+ | break; | ||
+ | |||
+ | case 'button': break; | ||
+ | |||
+ | default: dformsnrelement.value = dataarray[num][i-r]; | ||
+ | break; | ||
+ | |||
} | } | ||
- | + | document.getElementById("targetselection").src = scriptoutput; | |
- | + | ||
- | + | ||
} | } | ||
- | |||
- | |||
- | |||
} | } | ||
Revision as of 10:01, 24 October 2010
|
|
||||||||||||||||||||||||||