-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs_function.js
46 lines (45 loc) · 1.13 KB
/
js_function.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
function get_value(select)
{
selects=document.getElementById(select);
var Element=document.getElementsByName(select)[0];
if (Element.value=="")
{
Element.value=0;
}
Element.value=selects.options[selects.selectedIndex].value;
}
function get_value_flag(select)
{
var Element=document.getElementsByName(select)[0];
selects=document.getElementById(select);
if (selects.options[selects.selectedIndex].className != "target")
{
selects.options[selects.selectedIndex].className="target";
for (var i=1; i<selects.options.length; i++)
{
if(selects.options[i].className != "target")
{
if(Element.value=="")
{
Element.value=0;
}
Element.value=parseInt(Element.value)+parseInt(selects.options[selects.selectedIndex].value);
break;
}
else
{
if(i==selects.options.length-1)
{
Element.value="-1";
}
}
}
selects.selectedIndex=0;
}
else if (selects.options[selects.selectedIndex].className=="target")
{
Element.value=parseInt(Element.value)-parseInt(selects.options[selects.selectedIndex].value);
selects.options[selects.selectedIndex].className="";
selects.selectedIndex=0;
}
}