Александр Горшунов! Хорошо, прошу помощи. Смотрите, пожалуйста, вложение ниже — в Блокноте. Всё без подвоха и глупостей. Почему этот "scripts/treelist.js", чистая коммерция — всё гласно и открыто, не выполняется в браузере? В чём дело? Чего ему не хватает?
Справка: на смену DHTML пришёл HTML-5, сам путаюсь. Многие скрипты, начиная с 2000 года — возможно: не отвечают стандартам, морально устарели. Изучаю причины нестыковок.
Но скрипт "treelist.js" совсем свежий, отображался во всех браузерах. Сам взял его текст из публичного коммерческого сайта — путем стандартных манипуляций по кодировке JS. Отвечу через ЛС на любые Ваши вопросы.
Вложение сделать не смог, написано при Закачке: Закачка была отклонена, так как вложение было определено как возможная атака. Размер текстового файла 22 Кб, как быть?
Или так, то же неудачно: Расширение html запрещено администратором. Закачка была отклонена, так как вложение было определено как возможная атака.
Ну, ладно. Пишу открытым текстом!
<BODY> //=========================================================//function TTreeList_imgOpen(el){mySetAttribute(document.getElementById('o' + this.name + el.id), {"src":this.baseimg+((el.opens) ? 'open' : 'close') + ((el.pos == -1)?'_bottom':((el.pos==1)?'_top':'')) + '.png', "title": ((el.opens) ? "Свернуть " : "Развернуть ") + el.title});};function TTreeList_Select_rec(el, flag){if ((this.type == 2 && flag == null && el.sel == 1) || el == this || !el) return;var old_sel = el.sel;el.sel = (flag == null) ? ((el.sel == 0 || el.sel ==2)?1:0) : flag;if (el.id != this.id) mySetAttribute(document.getElementById('s' + this.name + el.id), {"src":this.baseimg + ((el.sel==0) ? 'un' : '') + this.imgSel + ((flag==2)?"1":"") + '.png', "title":((this.type == 1) ? (((el.sel == 0 || el.sel == 2) ? "Выбрать " : "Убрать ") + el.title) : ((el.sel == 0 || el.sel == 2) ? "Выбрать " + el.title : ""))});if (this.type == 1 && (el.sel == 0 || (el.sel == 1 && old_sel == 2)) && el.child != 0 && el.inarr) for (var num in el.inarr) this.select_rec(el.inarr[num], 0);//Убираем подчиненныеelse if (this.type == 2 && el.sel == 1){for(var key in this.arrSel){if (key != el.id) this.select_rec(this.arrSel[key], 0);};this.arrSel = new Array();};if (el.id != this.id && this.type == 2 && flag != 2) mySetAttribute(document.getElementById('a' + this.name + el.id), {"class":(el.sel>0)?"treelist_sel":""});if (el.sel > 0){if (this.type == 2) this.arrSel[el.id] = el;if (el.id != this.id) this.select_rec(el.par_arr, 2);};if (this.isfolder && flag == null)for (var i=0; i < this.childElement.length; i++)this.childElement[i].rePaint(true);if (this.ComplexChange) eval(this.ComplexChange);};function TTreeList_setChilds(el, id, par, title, child, img, pos){var obj = this, mydiv = document.getElementById(this.name + ((id != this.id)?el.id:''));var newImgSel = null;el.inarr[id] = {"id":id,"title":title,"par":par,"child":child, "loads":0,"opens":false, "lavel":((el[par])?el[par].lavel + 1:0),"pos": pos , "sel": 0, "par_arr":el};var newDiv = (mydiv.id == this.name) ? mydiv : document.createElement("div");if (pos != -1 && pos != -2) newDiv.setAttribute('style', "background:url('"+this.baseimg+"line_v.png') repeat-y top left; text-align:left;");//var newImgSel =(mydiv.id != this.name) ? myCreateElement("img", {"id":'s' + this.name + id,"src":this.baseimg+"un"+this.imgSel+".png","style":"cursor:pointer","title":"Выбрать " + title}) : myCreateElement("img", {"src":this.img,"style":"padding:1px 4px 1px 0px;"});if (mydiv.id != this.name){newImgSel = myCreateElement("img", {"id":'s' + this.name + id,"src":this.baseimg+"un"+this.imgSel+".png","style":"cursor:pointer","title":"Выбрать " + title});newImgSel.onclick = function(a) {return function(){obj.select_rec(a)}} (el.inarr[id]);};var newImg = (child != 0) ? myCreateElement("img", {"id":"o" + this.name + id, "src":this.baseimg+"close"+((pos == -1)?"_bottom":((pos == 1)?"_top":""))+".png","style":((child != 0)?"cursor:pointer":""),"title":"Развернуть " + title}) : myCreateElement("img", {"src":this.baseimg+"line_h"+((el.inarr[id].pos==-1)?"_bottom":"")+".png"});if (child != 0) newImg.onclick = function(a) {return function(){obj.loadData(a)}} (el.inarr[id]);newDiv.appendChild(newImg);var newDivA = myCreateElement("a", {"href":"javascript:","id":"a" + this.name + id});//newDivA.onclick = (child != 0) ? function(a) {return function(){obj.loadData(a);}} (el.inarr[id]) : function(a) {return function(){obj.select_rec(a)}} (el.inarr[id]);newDivA.onclick = (child != 0) ? function() {obj.select_rec(el.inarr[id], ((el.inarr[id].loads == 0 || !el.inarr[id].opens)?1:0)); obj.loadData(el.inarr[id]);} : function() {obj.select_rec(el.inarr[id]);};newDivA.onclick = (child != 0)? function() {//obj.select_rec(el.inarr[id], ((el.inarr[id].loads == 0 || !el.inarr[id].opens)?1:0));if (el.inarr[id].sel != 1) obj.select_rec(el.inarr[id], 1);obj.loadData(el.inarr[id]);}: function() {obj.select_rec(el.inarr[id]);};var newDiv2 = myCreateElement("div", {"id":this.name + id, "style":"padding-left:18px;"});if (this.isfolder && id>0) newDivA.appendChild(myCreateElement("img", {"src":this.baseimg + '_f' + id + '.gif'}));if (img != ''){var myImg = myCreateElement("img", {"src":((img.indexOf('http://') == -1)? this.baseimg+img : img), "style":((this.id == id)?"padding:1px 4px 1px 0px;":"padding-right:4px;")});newDivA.appendChild(myImg);};newDivA.appendChild(document.createTextNode(title));if (newImgSel != null) newDiv.appendChild(newImgSel);newDiv.appendChild(newDivA);newDiv.appendChild(newDiv2);if (mydiv != newDiv) mydiv.appendChild(newDiv);if (this.getQuery(el, id)){this.select_rec(el.inarr[id], ((el.inarr[id].inquery == '')?1:2));if (el.inarr[id].inquery != '' && this.opens == 2) this.loadData(el.inarr[id]);};};function TTreeList_perebor(el, value){if (value == '') return;//value = value.replace(/\s+/g,'');var arr = JSON.parse (value);el.inarr = new Array();for (var i=0; i < arr.data.length; i++) this.setChilds(el, arr.data[i].id, el.id, arr.data[i].nm, arr.data[i].c, ((arr.data[i].img)?arr.data[i].img:''), ((i == arr.data.length-1)?-1:0));el.loads = 2;el.opens = true;this.imgOpen(el);if (this.isfolder)for (var i=0; i < this.childElement.length; i++)this.childElement[i].rePaint(false);};function TTreeList_loadData(el){if (el.loads == 0){el.loads = 1;var req = getXmlHttp(), obj=this, parent = el.id;if (document.getElementById('o' + this.name + el.id)) document.getElementById('o' + this.name + el.id).src = this.baseimg + 'load16.gif';if (this.folders) parent = this.trFolder.query().replace(/\(([1-6]+)\)/g, "$1");var url = this.url + '?p=' + parent;req.onreadystatechange = function(){if (req.readyState == 4 && req.status == 200) obj.perebor(el, req.responseText);};req.open("GET", url, true);req.send(null);}else if (el.loads == 2){el.opens = ! el.opens;document.getElementById(this.name + el.id).style.display = (el.opens) ? "block" : "none";this.imgOpen(el);};};function TTreeList_query(arr){var s = '', q='';if (arr == null) arr = this.inarr[this.id];for (var num in arr.inarr){if (arr.inarr[num].sel > 0) s += '(' + arr.inarr[num].id + this.query(arr.inarr[num]) + ')';/*if (arr.inarr[num].sel > 0 && this.type==1) s += '(' + arr.inarr[num].id + this.query(arr.inarr[num]) + ')';if (this.type==2){if (arr.inarr[num].sel == 2) s = this.query(arr.inarr[num]);if (arr.inarr[num].sel == 1) s = arr.inarr[num].id;};*/};return s;};function TTreeList_getQuery(el,id){if (! el.inquery || el.inquery.search("\\(" + id+ "[\\(|\\)]{1}") == -1) return false;el.inarr[id].inquery = (el.inquery.search("\\(" + id+ "[\\(]{1}") != -1) ? el.inquery.match("\\(" + id+ "\(\\(.*)\\)")[1] : '';return true;};function TTreeList_paint(pos){this.pos = pos;document.write(' <DIV id="' + this.name + '" style="text-align:left;" ></DIV> ');this.setChilds(this, this.id, -1, this.title, 1, this.img, this.pos);this.inarr[this.id].inquery = this.inquery;if (this.opens > 0 && ! this.folders) this.loadData(this.inarr[this.id]);};function TTreeList_rePaint(reQuery){var mydiv = document.getElementById(this.name);var query = (reQuery) ? this.query() : this.inquery;var opens = (this.inarr[this.id] && this.inarr[this.id].opens) || this.opens > 0;myRemoveChild(mydiv, false);//if (mydiv) while (mydiv.childNodes.length > 0) mydiv.removeChild(mydiv.lastChild);this.inarr = new Array();this.setChilds(this, this.id, -1, this.title, 1, this.img, this.pos);this.inarr[this.id].inquery = query;if (opens || this.inarr[this.id].inquery != '') this.loadData(this.inarr[this.id]);};function TTreeList_inloads(){//this.inarr//return res;};//Конструктор объектаfunction TTreeList(name, type, opens, id, inquery, par){var arr_type = {'folder':{'url':'ajax_folder.html', 'img':'_folder.gif', 'title':'Разделы', 'isfolder':true, 'opens':1},'object':{'url':'ajax_object.html', 'img':'_object.gif', 'title':'Объекты', 'folders':true, 'opens':0},'house':{'url':'ajax_house.html', 'img':'_house.gif', 'title':'Типажи', 'folders':true},'mat':{'url':'ajax_mat.html', 'img':'_mat.gif', 'title':'Материал'},'ap':{'url':'ajax_ap.html', 'img':'_ap.gif', 'title':'Классификатор', 'folders':true},'firms':{'url':'ajax_firms' + par + '.html', 'img':'_firms.gif', 'title':'Фирмы'},'agents':{'url':'ajax_agents' + par + '.html', 'img':'_agents.gif', 'title':'Агенты'},'users':{'url':'ajax_users' + par + '.html', 'img':'_agents.gif', 'title':'Агенты'},'adr':{'url':'ajax_treeadr.html', 'img':'_adr.gif', 'title':'Месторасположение'},'fantom':{'url':'ajax_fantom.html', 'img':'_fantom.gif', 'title':'Фантомы'},'getfor':{'url':'ajax_getfor_' + par + '.html', 'img':'_getfor.gif', 'title':'Статус'},'exp':{'url':'ajax_exp_' + par + '.html', 'img':'_exp.gif', 'title':'Экспорты'},'onpage':{'url':'ajax_onpage.html', 'img':'_onpage.gif', 'title':'На странице', 'opens':3}};//this.inload = function TTreeList_inloads;this.imgOpen = TTreeList_imgOpen;this.select_rec = TTreeList_Select_rec;this.setChilds = TTreeList_setChilds;this.perebor = TTreeList_perebor;this.loadData = TTreeList_loadData;this.query = TTreeList_query;this.getQuery = TTreeList_getQuery;this.paint = TTreeList_paint;this.rePaint = TTreeList_rePaint;this.base = 'http://www.vrx.ru/scripts/';this.baseimg = '/im/tree/';this.url = this.base + arr_type[name].url;this.id = (id != null && id != '') ? id : -1;this.name = name;if (arr_type[name].isfolder) this.isfolder = arr_type[name].isfolder;if (arr_type[name].folders) this.folders = arr_type[name].folders;this.title = arr_type[name].title;this.type = (type == 1)?1:((type == 2)?2:0);//this.img = this.baseimg + arr_type[name].img;this.img = arr_type[name].img;this.inarr = new Array();this.imgSel = ((this.type == 1) ? 'chk' : ((this.type == 2) ? 'flg' : ''));this.arrSel = new Array();this.inquery = inquery;this.opens = (opens == 3) ? 0 : opens;if (arr_type[name].opens) this.opens = ((arr_type[name].opens != 3) ? arr_type[name].opens : 0);if (inquery != '' && this.opens != 3) this.opens = 2;this.opens = opens;if (arr_type[name].opens) this.opens = arr_type[name].opens;if (inquery != '' && this.opens != 3) this.opens = 2;if (this.opens == 3) this.opens = 0;};//Конструктор объекта общийfunction TTree(arg, type, opens, paint){this.objects = new Array();type = (type == null) ? 1 : type;opens = (opens == null) ? 2 : opens;var n = 0;for (var i=0; i < arg.length; i++)if (arg[i].name){this.objects[arg[i].name] = new TTreeList(arg[i].name, ((arg[i].type)?arg[i].type:type), ((arg[i].opens)?arg[i].opens:opens), ((arg[i].id)?arg[i].id:''), ((arg[i].inquery)?arg[i].inquery:''), ((arg[i].par)?arg[i].par:''));if (this.objects[arg[i].name].isfolder){var element_name = arg[i].name;this.objects[arg[i].name].childElement = new Array();};if (this.objects[arg[i].name].folders){n = this.objects[element_name].childElement.length;this.objects[element_name].childElement[n] = this.objects[arg[i].name];this.objects[arg[i].name].trFolder = this.objects[element_name];};};if (paint == true)for (var i=0; i < arg.length; i++)this.objects[arg[i].name].paint(((i==0)?1:(i==arg.length-1)?-1:0));};//=========================================================////========= Объект адресов из селектов============//function TAdrSel_NumHouse(ins){if (this.Element[6]) this.Element[6].td.innerHTML = (ins) ? ' д: <INPUT type="text" name="numhouse" class="inputform' + ((this.Element[6].internal == 1) ?'_internal':'') + '" value="' + this.Element[6].house + '" style="width:50px;" > ' + ((this.Element[6].flat != null)? ' кв: <INPUT type="text" name="numflat" class="inputform' + ((this.Element[6].internal == 1) ?'_internal':'') + '" value="' + this.Element[6].flat + '" style="width:30px;" > ' : '') + ((this.Element[6].internal >= 0) ? ' <INPUT type="checkbox" name="internal_num" id="internal_num" value="1" ((this.element[6].internal="=" > <LABEL for="internal_num" >скрыть</LABEL> ' : '') : '';};function TAdrSel_PrnLoad(type, cls){this.Element[type].td.className = '';if (this.Element[type].sel) this.Element[type].sel.className = '';if (this.Element[type].sel && this.Element[type].sel.parentNode != null) this.Element[type].sel.className = cls; else this.Element[type].td.className = cls;};function TAdrSel_AddListing(i){var myDiv = myCreateElement('div', {}, this.arr_adr.td);var inp = myCreateElement('input', {'type':'hidden', 'name':'adress[]', 'value':this.arr_adr[i].faset}, myDiv);var inp2 = myCreateElement('input', {'type':'hidden', 'name':'adress_name[]', 'value':this.arr_adr[i].name}, myDiv);myDiv.appendChild(document.createTextNode(this.arr_adr[i].name));var myImg = myCreateElement('img', {'src':'img/d.gif', 'style' :'cursor:pointer;', 'id':'img'+i}, myDiv);myImg.attr = {'arr':this.arr_adr, 'elm':this.arr_adr[i]};myImg.onclick = this.delAdr;};function TAdrSel_DelAdrInList(){if (this.attr.elm && this.parentNode)if (window.confirm('Вы хотите удалить адрес: ' + this.attr.elm.name + '?')){var deleting = (this.attr.arr.length >= this.attr.arr.parent.max_adr);myRemoveChild(this.parentNode, true);var inx = myArrFind(this.attr.arr, this.attr.elm.faset, -1,'faset')if (inx != -1) this.attr.arr.splice(inx, 1);if (this.attr.arr.parent.btnadd){if (this.attr.arr.length < this.attr.arr.parent.max_adr && deleting){this.arr_inx = [0];this.attr.arr.parent.Loads(0, -2, true);this.attr.arr.parent.td_sel.appendChild(this.attr.arr.parent.btnadd);};this.attr.arr.parent.btnChange();};};};function TAdrSel_BtnAddChange(){this.btnadd.faset = '';this.btnadd.name = '';for (var i=0; i<=5; i++){if (this.Element[i].sel && this.Element[i].sel.value > 0 && i<= 3) this.btnadd.faset = this.Element[i].sel.value;this.btnadd.name += (this.Element[i].sel && this.Element[i].sel.selectedIndex && this.Element[i].sel.options[this.Element[i].sel.selectedIndex]) ? ((this.btnadd.name != '') ? ((i<= 3) ? ', ' : ' / ') : '') + this.Element[i].sel.options[this.Element[i].sel.selectedIndex].text : '';};this.btnadd.faset = 'a' + this.btnadd.faset + 'd' + ((this.Element[4].sel && this.Element[4].sel.value != '')?this.Element[4].sel.value:0) + 'p' + ((this.Element[5].sel && this.Element[5].sel.value != '')? this.Element[5].sel.value : 0) + 'e';if ((this.Element[2].val > 0 || this.Element[4].val > 0 || this.Element[5].val > 0) && (this.arr_adr.length < this.max_adr) && myArrFind(this.arr_adr, this.btnadd.faset, -1,'faset') == -1){this.btnadd.src = this.btnadd_enable;var obj = this;this.btnadd.onclick = function () {obj.btnPost(obj);};this.btnadd.style.cursor = 'pointer';}else{this.btnadd.src = this.btnadd_disable;this.btnadd.onclick = null;this.btnadd.style.cursor = ' default';};};function TAdrSel_BtnClick(){var i = this.arr_adr.length;this.arr_adr[i] = {'faset':this.btnadd.faset,'name':this.btnadd.name};this.addList(i);var region = this.Element[0].val;for (var i=0; i<=5; i++){if (i > 0) this.Element[i].val = 0;myRemoveChild(this.Element[i].sel, true);this.arr_inx = [0];};if (this.arr_adr.length < this.max_adr) this.Loads(0, -2, true); else myRemoveChild(this.btnadd, true);};//Загрузка данныхfunction TAdrSel_Load(type, parent, attr){if (parent == '') {this.CreateElm(type, '', attr); return;};this.imgLoadShow(type, 'adr_loads');var req = getXmlHttp(), obj = this;req.onreadystatechange = function(){if (req.readyState == 4 && req.status == 200) obj.CreateElm(type, req.responseText, attr);};req.open("GET", this.baseurl + this.Element[type].url + '?p=' + parent, true);req.send(null);};//Основные функцииfunction TAdrSel_change(type, attr){this.Element[type].val = this.Element[type].sel.value;var inxThis = myArrFind(this.arr_inx, type, 100);if (this.Element[type].val != '0' && inxThis == 100){this.arr_inx.push(type);inxThis = this.arr_inx.length-1;}elseif (this.Element[type].val == '0' && inxThis != 100){if (inxThis+1 < this.arr_inx.length) for (var i=inxThis+1; i < this.arr_inx.length; i++) if (this.Element[this.arr_inx[i]].sel) this.Element[this.arr_inx[i]].val = 0;this.arr_inx.splice (inxThis + ((this.Element[type].val == '0')?0:1), (this.arr_inx.length - inxThis + ((this.Element[type].val == '0')?1:0)));};var parent_st = (this.Element[2].sel && this.Element[2].sel.value != 0) ? this.Element[2].sel.value : ((this.Element[1].sel) ? this.Element[1].sel.value : '');var inxStreet = myArrFind(this.arr_inx, 2, 100);var inxDistrict = myArrFind(this.arr_inx, 4, 100);var inxPlace = myArrFind(this.arr_inx, 5, 100);switch (type){case 0:this.Loads(1, this.Element[type].sel.value, attr);break;case 1: {this.Loads(2, this.Element[type].val, attr);this.Loads(4, this.Element[type].val, attr);this.Loads(5, this.Element[type].val, attr);};break;case 2: {this.Loads(3, ((this.Element[2].sel.options[this.Element[2].sel.selectedIndex].getAttribute('chld') == '1') ? this.Element[2].val : ''), attr);// Было так 28.05.2015//if (inxThis > inxDistrict) this.Loads(4, parent_st + ((inxThis > inxPlace && inxPlace < inxDistrict) ? '&pl=' + this.Element[5].val : ''), attr);if (inxThis < inxDistrict) this.Loads(4, parent_st + ((inxThis > inxPlace && inxPlace < inxDistrict) ? '&pl=' + this.Element[5].val : ''), attr);if (inxThis < inxPlace) this.Loads(5, parent_st + ((inxThis > inxDistrict && inxDistrict < inxPlace) ? '&d=' + this.Element[4].val : ''), attr);this.NumHouse(this.Element[type].val != '0' && this.Element[type].sel.options[this.Element[type].sel.selectedIndex].getAttribute('chld') != 1);};break;case 3:this.NumHouse(this.Element[type].val != '0' && this.Element[type].sel.options[this.Element[type].sel.selectedIndex].getAttribute('chld') != 1);break;case 4: {if (inxThis < inxStreet) this.Loads(2, this.Element[1].val + ((inxThis > inxPlace && inxPlace < inxStreet) ? '&pl=' + this.Element[5].val : '') + '&d=' + this.Element[4].val, attr);if (inxThis < inxPlace) this.Loads(5, ((inxThis > inxStreet && inxStreet < inxPlace) ? parent_st : this.Element[1].val) + '&d=' + this.Element[4].val, attr);};break;case 5: {if (inxThis < inxStreet) this.Loads(2, this.Element[1].sel.value + ((inxThis > inxDistrict && inxDistrict < inxStreet) ? '&d=' + this.Element[4].val : '') + '&pl=' + this.Element[5].sel.value, attr);if (inxThis < inxDistrict) this.Loads(4, ((inxThis > inxStreet && inxStreet < inxDistrict) ? parent_st : this.Element[1].val) + '&pl=' + this.Element[5].val, attr);};break;};if (this.btnadd) this.btnChange();if (this.ComplexChange && this.ComplexChange != '' && attr) eval(this.ComplexChange);};function TAdrSel_CreateElm(type, text, attr){var obj = this;if (this.Element[type].sel == null) this.Element[type].sel = myCreateElement('select', {'name':this.Element[type].id}); else if (text == '') this.Element[type].val = 0;myRemoveChild(this.Element[type].sel, true);if (type == 2) this.Loads(3, '', true);if (type == 2 || type == 3) this.NumHouse(false);this.imgLoadShow(type, '');if (text != ''){var arr = JSON.parse (text);if (arr.data.length > 0){var firstOpt = this.Element[type].txt;if (type == 2) if (parseInt(this.Element[1].sel.value.substr(2,3)) != 0) firstOpt = 'Выберите нас. пункт...';this.Element[type].sel.onchange = function() {obj.ChangeElm(type, attr)};myAddOpt(this.Element[type].sel, {'id':'opt0','value':0,'chld':0}, true, firstOpt);if (arr.data.length == 1) this.Element[type].val = arr.data[0].id;for (var i=0; i < arr.data.length; i++) myAddOpt(this.Element[type].sel, {'value':arr.data[i].id,'chld':arr.data[i].c}, (arr.data.length == 1 || arr.data[i].id == this.Element[type].val), arr.data[i].nm);};this.Element[type].td.appendChild(this.Element[type].sel);if (this.Element[type].val > 0) this.ChangeElm(type, attr);};};//Создаем объектfunction TAdrSel_create(){document.write(' <STYLE>select option#opt0 {font: italic 11px Arial, Helvetica, sans-serif; color:#999; padding-bottom:3px;}#adress_in div {font-weight:bold;padding: 1px 0px 1px 10px;}#adress_in div img {padding-left: 10px;vertical-align:middle;}.adr_loads {background: url(\'' + this.imgLoad + '\') no-repeat left;}#myTblAdrSelect{padding: 5px; border:0px #CCC solid;width:100%;}</STYLE> ');document.write(' <TABLE width="5%" border="0" cellspacing="0" cellpadding="0" class="text" id="myTblAdrSelect" ></TABLE> ');var tbl = document.getElementById('myTblAdrSelect');if (this.arr_adr != null){var myImg, myDiv;var tr = myCreateElement('tr', {}, tbl);this.arr_adr.td = myCreateElement('td', {'id':'adress_in', 'colspan':5}, tr);for (var i=0; i< this.arr_adr.length; i++) this.addList(i);};var tr1 = myCreateElement('tr', {}, tbl);for (i=0; i<=3; i++) this.Element[i].td = myCreateElement('td', {'nowrap':'nowrap','align':'left','width':(((i ==3 && (this.Element[6] || this.btnadd !== false)) || i<3)?'1%':'97%')}, tr1);if (this.Element[6]) this.Element[6].td = myCreateElement('td', {'nowrap':'nowrap','align':'left', 'width':'96%'}, tr1);if (this.btnadd !== false){this.td_sel = myCreateElement('td', {'nowrap':'nowrap', 'rowspan':2, 'align':'left','valign':'top'}, tr1);this.btnadd = myCreateElement('img', {'src':this.btnadd_disable,'style':'padding-left:10px;'}, this.td_sel);};var tr2 = myCreateElement('tr', {}, tbl);myCreateElement('td', {'nowrap':'nowrap', 'width':'1%'}, tr2);this.Element[4].td = myCreateElement('td', {'nowrap':'nowrap', 'width':'1%','align':'left'}, tr2);this.Element[5].td = myCreateElement('td', {'nowrap':'nowrap','colspan':3,'align':'left'}, tr2);if ((this.btnadd !== false && this.arr_adr.length < this.max_adr) || this.btnadd === false) this.Loads(0, -2, true);};function TAdrSel_inloads(){var res = false;for (var i=0; i<=5; i++)if (!res && this.Element[i].sel && (this.Element[i].sel.className != '' || this.Element[i].td.className != '')) res = true;return res;};//Конструктор объектаfunction TAdrSel(obj_in, arr_adr, arr_max){this.baseurl = 'http://www.vrx.ru/scripts/';this.imgLoad = '/im/tree/load16.gif';this.max_adr = arr_max;this.btnadd_enable = '/im/btn/btnadd.png';this.btnadd_disable = '/im/btn/btnadd_disable.png';this.arr_adr = arr_adr;if (this.arr_adr != null) this.arr_adr.parent = this;this.btnadd = (this.arr_adr != null && this.arr_adr.length >= 0 && (this.arr_adr.length < this.max_adr));this.Element = [{'id':'region','txt':'Выберите регион ...','val':obj_in.region,'url':'ajax_adr.html', 'td':null},{'id':'raion','txt':'Выберите город/район ...','val':obj_in.raion,'url':'ajax_adr.html', 'td':null},{'id':'street','txt':'Выберите улицу ...','val':obj_in.street,'url':'ajax_adr.html', 'td':null},{'id':'street2','txt':'Выберите улицу ...','val':obj_in.street2,'url':'ajax_adr.html', 'td':null},{'id':'district','txt':'Выберите адм. район ...','val':obj_in.district,'url':'ajax_adr_district.html', 'td':null},{'id':'place','txt':'Выберите район города...','val':obj_in.place,'url':'ajax_adr_place.html', 'td':null}];if (obj_in.house != null) this.Element[6] = {'id':'housenum','txt':'Выберите район города...','house':obj_in.house,'flat':obj_in.flat,'internal':obj_in.internal, 'td':null};this.arr_inx = [0];for (var i=1; i<=5; i++) if (this.Element[i].val > 0) this.arr_inx.push(i);this.Create = TAdrSel_create;this.Loads = TAdrSel_Load;this.CreateElm = TAdrSel_CreateElm;this.ChangeElm = TAdrSel_change;this.NumHouse = TAdrSel_NumHouse;this.imgLoadShow = TAdrSel_PrnLoad;this.btnChange = TAdrSel_BtnAddChange;this.btnPost = TAdrSel_BtnClick;this.delAdr = TAdrSel_DelAdrInList;this.addList = TAdrSel_AddListing;this.inloads = TAdrSel_inloads;};//=========================================================// </BODY>
|