Ich habe hier mal nach MooTools umgeschrieben. Habe die Logik mal etwas verändert.
PHP-Code:
(function($) {
window.addEvent('domready', function() {
var regionalforum = $('ctrl_xt_regioforum'),
plz = $('ctrl_postal'),
forumPrefix = 'Forum ',
forums = [
'Sachsen+Thüringen', // 00
'Berlin/Brandenburg + NO-Dtl', // 01
'Hamburg', // 02
'Schleswig-Holstein', // 03
'südl. Niedersachsen', // 04
'Münster', // 05
'Rhein-Main+ Mittelhessen', // 06
'Ruhrgebiet / Niederrhein', // 07
'Münsterland', // 08
'Köln', // 09
'Aachen-Dreiländereck', // 10
'Bonn / Rhein-Sieg / Ahr', // 11
'Württemberg', // 12
'München', // 13
'Schwaben', // 14
'Erlangen-Nürnberg' // 15
],
forum = '';
plz.addEvent('keyup', function() {
if (this.value >= 1001 && this.value <= 99998) {
if (this.value >= 99000) {
forum = forums[0];
}
else if (this.value >= 90000) {
forum = forums[15];
}
else if (this.value >= 88000) {
forum = forums[14];
}
else if (this.value >= 87000) {
forum = forums[13];
}
else if (this.value >= 86000) {
forum = forums[14];
}
else if (this.value >= 80000) {
forum = forums[13];
}
else if (this.value >= 79000) {
forum = forums[12];
}
else if (this.value >= 78000) {
forum = forums[14];
}
else if (this.value >= 70000) {
forum = forums[12];
}
else if (this.value >= 60000) {
forum = forums[6];
}
else if (this.value >= 58000) {
forum = forums[7];
}
else if (this.value >= 56000) {
forum = forums[11];
}
else if (this.value >= 55000) {
forum = forums[6];
}
else if (this.value >= 53000) {
forum = forums[11];
}
else if (this.value >= 52000) {
forum = forums[10];
}
else if (this.value >= 50000) {
forum = forums[9];
}
else if (this.value >= 48000) {
forum = forums[8];
}
else if (this.value >= 40000) {
forum = forums[7];
}
else if (this.value >= 37000) {
forum = forums[4];
}
else if (this.value >= 34000) {
forum = forums[6];
}
else if (this.value >= 32000) {
forum = forums[5];
}
else if (this.value >= 29000) {
forum = forums[4];
}
else if (this.value >= 26000) {
forum = forums[2];
}
else if (this.value >= 23000) {
forum = forums[3];
}
else if (this.value >= 20000) {
forum = forums[2];
}
else if (this.value >= 10000) {
forum = forums[1];
}
else {
forum = forums[0];
}
regionalforum.value = forumPrefix + forum;
}
else {
regionalforum.value = 'Ausland';
}
});
});
})(document.id);
Lesezeichen