Zu den Aufzeichnungen der tutorials.de-Live-Workshops
ERLEDIGT
NEIN
ANTWORTEN
2
ZUGRIFFE
1070
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    yasukatakaya yasukatakaya ist offline Mitglied Bronze
    Registriert seit
    Jun 2007
    Beiträge
    31
    Moin,
    kann mir jemand bitte sagen, ob ich in eine Auswahlliste (bzw. Combobox) Werte einlesen kann, z.B. die Namen von ein paar Ordnern?
    Da diese sich ständig ändern können, deswegen kann ich diese Namen nicht von vornehinein vergeben!

    Ich hoffe mir kann jemand weiterhelfen?!

    Gruss
    yasukatakaya
     

  2. #2
    Avatar von Sven Mintel
    Sven Mintel Sven Mintel ist offline Mitglied
    Registriert seit
    Aug 2003
    Beiträge
    18.238
    Blog-Einträge
    6
    Moin,

    mit JS alleine geht das nicht, da dies eine Sprache vorraussetzt, welche dazu in der Lage ist, das entsprechende Verzeichnis auf dem Server zu Lesen, was JS nicht kann. Was du benötigst, wäre eine serverseitige Sprache wie bspw. PHP
     

  3. #3
    karl123 karl123 ist offline Mitglied Silber
    Registriert seit
    Nov 2008
    Ort
    Püttlingen (Saarland)
    Beiträge
    91
    So etwas gibt es. Schau mal bei http://javascript.jstruebig.de/javascript/68/#more-68

    Geändert:
    Sorry, die Combobox, die sich etwas merkt, habe ich hier. Ich weiß nur nicht mehr, wo ich die her habe.
    Code :
    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
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    
    /*
        combobox
        Version: 2.2.1
        
        Änderungen:
        
        2.2.1
        Das Boxmodell richtig berechnen
        
    */
     
    function createCombobox() {
        if( !document.createElement) return;
        
        var inputName = 'input_' + Math.random();
        var tmp, x, offset_height, width_scrollbar
        // padding und border ermitteln, wg. Boxmodell
        tmp = document.createElement('input');
        document.body.appendChild( tmp );
        x = tmp.offsetHeight;
        tmp.style.border = 'none';
        tmp.style.padding = '0';
        offset_height = x - tmp.offsetHeight;
        document.body.removeChild( tmp );
        
        // und die Größe der Scrollbars
        document.body.style.overflow = 'hidden';
        x = document.body.offsetWidth || document.body.clientWidth;
        document.body.style.overflow = 'scroll';
        
        width_scrollbar = x - (document.body.offsetWidth || document.body.clientWidth);
        if(!width_scrollbar) width_scrollbar = document.body.offsetWidth  - document.body.scrollWidth;
        width_scrollbar += offset_height;
        document.body.style.overflow = '';
        
     
        
        function addInput(el) {
            /*/////////////////////////////////////////////////
            der Auswahliste das Inputfeld hinzufügen
            /////////////////////////////////////////////////*/
     
            // Das Inputfeld
            var input = document.createElement('input');
            input.style.position = 'absolute';
     
            input.parent = el;
            
            if(IE) {
                /*/////////////////////////////////////////////////
                IE Bug
                Der IE überdeckt keine Auswahliste mit anderen Elementen
                ausser mit iframes, daher muss für den IE ein zusätzliches DIV, 
                mit einem iframe eingefügt werden.
                
                http://dotnetjunkies.com/WebLog/jking/archive/2003/07/21/488.aspx
                
                /////////////////////////////////////////////////*/
                var div = document.createElement('div');
                div.style.position = 'absolute';
                div.style.overflow = 'hidden';
     
                var iframe = document.createElement('iframe');
                iframe.style.position = 'absolute';
                iframe.scrolling = 'no';
                iframe.src = 'javascript:false';
                
                div.appendChild(iframe);
                el.form.appendChild(div);
                el.div = div;
     
                iframe.style.height = '100%';
                iframe.style.width = '100%';
            }
            el.form.appendChild(input);
            el[inputName] = input;
        }
     
        function fixSize(el) {
            /*/////////////////////////////////////////////////
            die Größe der Elemente an die Auswahliste anpassen
            /////////////////////////////////////////////////*/
            
            // Größe und Ort des Selectfeldes
     
            var r = getRect( el );
            
            // Das Inputfeld
     
            with( el[inputName] ){
                if (IE) {
                    style.top = (r.top+1) + 'px';
                    style.left = (r.left+1) + 'px';
                    style.border = 'none';
                } else {
                    style.top = r.top + 'px';
                    style.left = r.left + 'px';
                }
                style.height =  (-offset_height + r.height) + 'px';
                style.width = ( r.width - width_scrollbar ) + 'px';
            }
            
            return;
            // Im IE 7 geht es ohne den folgenden Code.
            if(IE) {
                /*/////////////////////////////////////////////////
                das DIV mit dem iframe
                /////////////////////////////////////////////////*/
                var x = el.div;
                x.style.top = r.top  + 'px';
                x.style.left = r.left + 'px';
                x.style.height = r.height + 'px';
                x.style.width = (r.width - width_scrollbar)+ 'px';
            }
        }
        
        function getRect (o){
            if(!o) return;
            var rect =  { left:0, top: 0, height: o.offsetHeight, width: o.offsetWidth };
            while (o)
            {
                 rect.top += parseInt(o.offsetTop );
                 rect.left += parseInt(o.offsetLeft );
                 o = o.offsetParent;
            }
            return rect;
        }
     
        /*
            Intialisierung
        */
        var IE = (document.all && !window.opera);
        var f = window.document.forms;
        
        // Alle Formulare
        for(var i = 0; i < f.length; i++)
            // Alle Elemente eines Formulares
            for(var k = 0; k < f[i].elements.length; k++) {
                var el = f[i].elements[k];
        
                if( !el || !el.type || el.type.indexOf('select') == -1
                || !el.className || 
                el.className.toLowerCase().indexOf('combobox') == -1
                ) 
                continue; // keine Combobox
                
                // Eine Hilfsfunktion um den gewählten Wert der Auswahliste zu ermitteln
                el.getValue = function() {
                return this.options[this.selectedIndex].value 
                || this.options[this.selectedIndex].text 
                || this.options[this.selectedIndex].innerText
                ;
                }
                
                /*
                Workaround:Eine Leerzeile einfügen, damit aus der Auswahliste 
                etwas gewählt werden kann, bzw. onchange feuert.
                */
                var l = el.options.length;
                while(l) {
                    el.options[l] = new Option( el.options[l - 1].text, el.options[l - 1].value) ;
                    l--;
                }
                el.options[0] = new Option(' ', ' ' );
                el.selectedIndex = 0;
                
                addInput(el);
                fixSize(el);
                
                el[inputName].name = el.name;
                //el.name = '';
                
                el[inputName].onfocus = function () {
                var c = this.parent;
                if(!c) return;
                if(this.value == c.getValue() ) this.value = '';
            };
            el.onchange = function() { this[inputName].value = this.getValue(); }
        }
    }
    Geändert von karl123 (19.12.08 um 17:29 Uhr)
     

Ähnliche Themen

  1. Auswahlfenster anzeigen
    Von BL1zz4RD im Forum Visual Basic 6.0
    Antworten: 1
    Letzter Beitrag: 01.02.07, 14:22
  2. Access, ComboBox gemäß ComboBox füllen?
    Von pglw im Forum Relationale Datenbanksysteme
    Antworten: 1
    Letzter Beitrag: 17.09.06, 22:08
  3. Datei-Auswahlfenster
    Von Memfis im Forum Visual Basic 6.0
    Antworten: 3
    Letzter Beitrag: 21.07.05, 17:18
  4. Combobox
    Von StefanLausL im Forum HTML & XHTML
    Antworten: 1
    Letzter Beitrag: 04.04.05, 08:09
  5. ComboBox mit DB
    Von fablio im Forum .NET Archiv
    Antworten: 1
    Letzter Beitrag: 04.02.05, 14:10