Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
875 lars 1
        $(function(){
2
            $('.add_value').click(add_value).button({
3
                icons:
4
                {
5
                    primary: "ui-icon-plus"
6
                }
7
            });
8
            $('.del_wert').click(del_wert).button({
9
                icons:
10
                {
11
                    primary: "ui-icon-trash"
12
                }
13
            });
14
            calcHeight();
15
        });
16
 
17
        function add_value(event)
18
        {
19
            event.preventDefault();
20
            var typ = $('#type').val();
21
            var anz = $('.auswahl').length;
22
            html = '<div style="float:left;height:25px;vertical-align:middle" id="auswahl_'+anz+'"><input type="text" name="auswahl['+anz+']" value="" class="auswahl" style="float:left;width:120px;"><button class="taste del_wert" id="del_wert_'+anz+'" style="float:left;margin-left:10px;width:40px;"></button></div>';
23
            $('#auswahl').append(html);
24
            $('.del_wert').click(del_wert).button({
25
                icons:
26
                {
27
                    primary: "ui-icon-trash"
28
                }
29
            });
30
            calcHeight();
31
        }
32
 
33
        function del_wert(event)
34
        {
35
            event.preventDefault();
36
            var f_id = this.id;
37
            f_id = f_id.split("_");
38
            f_id = f_id[2];
39
            $('#auswahl_'+f_id).remove();
40
            calcHeight();
41
        }
42
 
43
        function calcHeight()
44
        {
45
            var typ=$('#type').val();
46
            var w=0;
47
            var anz=0;
48
            var i_anz = 0;
49
            $('.add_value').each(function(index){
50
                w += parseFloat($(this).css("height"));
51
                anz++;
52
            })
53
            $('.auswahl').each(function(index){
54
                //w += parseFloat($(this).css("height"));
55
                i_anz++;
56
            })
57
            w+=i_anz * 25;
58
            w+=2*anz;
59
            if(typ==11)
60
            {
61
                w+=11*25;
62
            }
63
            w+="px";
64
            $('#auswahlwerte').css("height",w);
65
            $('#auswahl_eingabe').css("height",w);
66
        }