&$r){ $area[$k] = db::fa("select id, zip, title from _area where city={$r['id']} order by zip asc"); foreach($area[$k] as &$a){ $zip[] = $a['zip']; } } $json_city = json_encode($city); $json_area = json_encode($area); $nr = '\n'; $js = " var twzip = { city : $json_city, area : $json_area, init : function(n, fix_jquery_uniform){ if(cj.util.is(n, 'string')) n = cj.d.getElementById(n); if(!n) console.log('@cj.twzip(n) [' + n + ' is not defined!') var t = this, index,x,y; if(!/\d+/i.test(n.value)) n.value = 100; cj.util.each(n.parentNode.getElementsByTagName('select'),function(s,k){ if(k==0) n.z = s; if(k==1) n.c = s; if(k==2) n.a = s; }); if(!n.z) n.z = cj.util.addElm(n.parentNode, {tag:'select'}); if(!n.c) n.c = cj.util.addElm(n.parentNode, {tag:'select', attrib:'name:' + n.name.replace('_zip','_city')}); if(!n.a) n.a = cj.util.addElm(n.parentNode, {tag:'select', attrib:'name:' + n.name.replace('_zip','_area')}); index = x = 0; cj.util.each(t.area,function(i){ y = 0; cj.util.each(i,function(j){ var o = new Option(j.zip,j.zip) o.pos = [x,y]; o.area = j.id; n.z.options.add(o); if(n.value==j.zip) n.z.selectedIndex = index; y++; index++; }); x++ }); cj.util.each(t.city,function(i){ n.c.options.add(new Option(i.title,i.id)); }); n.c.onchange = function(){ t._clear(n.a); cj.util.each(t.area[n.c.selectedIndex],function(j){ n.a.options.add(new Option(j.title,j.id)); }); n.a.onchange(); } n.a.onchange = function(){ for(var i=0; i