1/* ==================================================================== 2ermittelt aus der PLZ den Ort 3(c)01/2024 fluSoft GbR, [email protected] | 25.01.2024 4====================================================================== */ 5console.log("plz2town geladen"); 6function UStId(){ 7let chBx = document.querySelectorAll("input[name='checkbox-wieder']"); 8alert("Wert: "+chBx[0].value); 9if (chBx[0].value == "Ja"){ 10 document.getElementById("ust_id").style.display="block"; 11} else { 12 document.getElementById("ust_id").style.display="none"; 13 }; 14}; 15 16function Plz2Town(){ 17console.log("plz2town aufgerufen"); 18let str=""; 19let town=""; 20var oldtown = window.document.bform.Ort.value; 21 document.all.select_ort.innerHTML = '<input class="formular kontakt" type="text" size="26" name="Ort" required title="Geben Sie bitte den Ortsnamen an!" value="'+oldtown+'"/>'; 22 const xhr = new XMLHttpRequest(); 23 let land =""; 24 if ((window.document.bform.Land.value.toUpperCase()=="DE") || 25 (window.document.bform.Land.value.toUpperCase()=="D")) 26 { land="de";}; 27 if ((window.document.bform.Land.value.toUpperCase()=="AT") || 28 (window.document.bform.Land.value.toUpperCase()=="A")) 29 { land="at";}; 30 if (window.document.bform.Land.value.toUpperCase()=="CH"){ land="ch";}; 31 32 if ((land=="at") || 33 (land=="de") || 34 (land=="ch")) 35 { 36 var req = "https://openplzapi.org/"+land+"/Localities?postalCode="+window.document.bform.Plz.value; 37 xhr.open("GET", req); 38 xhr.send(); 39 xhr.responseType = "text"; 40 xhr.onload = () => { 41 if (xhr.readyState == 4 && xhr.status == 200) { 42 var jdata = xhr.response; 43 let data = JSON.parse(jdata); 44 town = data[0].name; 45 console.log("Anz: "+data.length); 46 for (let i=0;i<data.length;i++){ 47 console.log("Stadt: "+data[i].name); 48 }; 49 console.log("----------------------------"); 50 if (data.length == 1){ 51 console.log("nur ein Ort zur PLZ "); 52 window.document.bform.Ort.value = town; 53 } else { 54 console.log("anderes Element erzeugen"); 55 str="<select name='Ort' class='kontakt' title='Bitte wählen Sie hier einen Ort aus!'>"; 56 for (let i=0;i<data.length;i++){ 57 if (oldtown == data[i].name) 58 str=str+"<option class='kontakt' value='"+data[i].name+"' selected>"+data[i].name+"</option>"; 59 else str=str+"<option class='kontakt' value='"+data[i].name+"'>"+data[i].name+"</option>"; 60 }; 61 str=str +"</select>"; 62 console.log("Element: "+str); 63 document.all.select_ort.innerHTML = str; 64 }; 65 } else { 66 console.log(`Error: ${xhr.status}`); 67 } 68 }; 69 }; 70}; 71
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.