Subversion-Projekte lars-tiefland.ci

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

        $(function(){
            $('.add_value').click(add_value).button({
                icons:
                {
                    primary: "ui-icon-plus"
                }
            });
            $('.del_wert').click(del_wert).button({
                icons:
                {
                    primary: "ui-icon-trash"
                }
            });
            calcHeight();
        });
    
        function add_value(event)
        {
            event.preventDefault();
            var typ = $('#type').val();
            var anz = $('.auswahl').length;
            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>';
            $('#auswahl').append(html);
            $('.del_wert').click(del_wert).button({
                icons:
                {
                    primary: "ui-icon-trash"
                }
            });
            calcHeight();
        }
        
        function del_wert(event)
        {
            event.preventDefault();
            var f_id = this.id;
            f_id = f_id.split("_");
            f_id = f_id[2];
            $('#auswahl_'+f_id).remove();
            calcHeight();
        }
        
        function calcHeight()
        {
            var typ=$('#type').val();
            var w=0;
            var anz=0;
            var i_anz = 0;
            $('.add_value').each(function(index){
                w += parseFloat($(this).css("height"));
                anz++;
            })
            $('.auswahl').each(function(index){
                //w += parseFloat($(this).css("height"));
                i_anz++;
            })
            w+=i_anz * 25;
            w+=2*anz;
            if(typ==11)
            {
                w+=11*25;
            }
            w+="px";
            $('#auswahlwerte').css("height",w);
            $('#auswahl_eingabe').css("height",w);
        }