Открытие в новом окне
Есть скрипт выбора даты, помогите сделать его открытие в новом окне браузера)
вот часть скрипта: var A_TCALDEF = { 'months' : ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'], 'weekdays' : ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 'yearscroll': true, // show year scroller 'weekstart': 0, // first day of week: 0-Su or 1-Mo 'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx. 'imgpath' : 'img/' // directory with calendar images }; // date parsing function function f_tcalParseDate (s_date) { var re_date = /^\s*(\d{1,2})\/(\d{1,2})\/(\d{2,4})\s*$/; if (!re_date.exec(s_date)) return alert ("Invalid date: '" + s_date + "'.\nAccepted format is mm/dd/yyyy.") var n_day = Number(RegExp.$2), n_month = Number(RegExp.$1), n_year = Number(RegExp.$3); if (n_year < 100) n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900); if (n_month < 1 || n_month > 12) return alert ("Invalid month value: '" + n_month + "'.\nAllowed range is 01-12."); var d_numdays = new Date(n_year, n_month, 0); if (n_day > d_numdays.getDate()) return alert("Invalid day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + "."); return new Date (n_year, n_month - 1, n_day); } // date generating function function f_tcalGenerDate (d_date) { return ( (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "/" + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + "/" + d_date.getFullYear() ); } // implementation function tcal (a_cfg, a_tpl) { // apply default template if not specified if (!a_tpl) a_tpl = A_TCALDEF; // register in global collections if (!window.A_TCALS) window.A_TCALS = []; if (!window.A_TCALSIDX) window.A_TCALSIDX = []; this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length; window.A_TCALS[this.s_id] = this; window.A_TCALSIDX[window.A_TCALSIDX.length] = this; // assign methods this.f_show = f_tcalShow; this.f_hide = f_tcalHide; this.f_toggle = f_tcalToggle; this.f_update = f_tcalUpdate; this.f_relDate = f_tcalRelDate; this.f_parseDate = f_tcalParseDate; this.f_generDate = f_tcalGenerDate; // create calendar icon this.s_iconId = 'tcalico_' + this.s_id; this.e_icon = f_getElement(this.s_iconId); if (!this.e_icon) { document.write('<img src="' + a_tpl.imgpath + 'cal.gif" id="' + this.s_iconId + '" onclick="A_TCALS[\'' + this.s_id + '\'].f_toggle()" class="tcalIcon" alt="Open Calendar" />'); this.e_icon = f_getElement(this.s_iconId); } // save received parameters this.a_cfg = a_cfg; this.a_tpl = a_tpl; } function f_tcalShow (d_date) { // find input field if (!this.a_cfg.controlname) throw("TC: control name is not specified"); if (this.a_cfg.formname) { var e_form = document.forms[this.a_cfg.formname]; if (!e_form) throw("TC: form '" + this.a_cfg.formname + "' can not be found"); this.e_input = e_form.elements[this.a_cfg.controlname]; } else this.e_input = f_getElement(this.a_cfg.controlname); if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT') throw("TC: element '" + this.a_cfg.controlname + "' does not exist in " + (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document')); // dynamically create HTML elements if needed this.e_div = f_getElement('tcal'); if (!this.e_div) { this.e_div = document.createElement("DIV"); this.e_div.id = 'tcal'; document.body.appendChild(this.e_div); } this.e_shade = f_getElement('tcalShade'); if (!this.e_shade) { this.e_shade = document.createElement("DIV"); this.e_shade.id = 'tcalShade'; document.body.appendChild(this.e_shade); } this.e_iframe = f_getElement('tcalIF'); if (b_ieFix && !this.e_iframe) { this.e_iframe = document.createElement("IFRAME"); this.e_iframe.style.filter = 'alpha(opacity=0)'; this.e_iframe.id = 'tcalIF'; this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif'; document.body.appendChild(this.e_iframe); } // hide all calendars f_tcalHideAll(); // generate HTML and show calendar this.e_icon = f_getElement(this.s_iconId); if (!this.f_update()) return; this.e_div.style.visibility = 'visible'; this.e_shade.style.visibility = 'visible'; if (this.e_iframe) this.e_iframe.style.visibility = 'visible'; // change icon and status this.e_icon.src = this.a_tpl.imgpath + 'no_cal.gif'; this.e_icon.title = 'Close Calendar'; this.b_visible = true; } |
этот кусок скрипта ничего не дает, по нему ничего не понятно...
|
весь скрипт не помещается
var A_TCALDEF = { 'months' : ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'], 'weekdays' : ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 'yearscroll': true, // show year scroller 'weekstart': 0, // first day of week: 0-Su or 1-Mo 'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx. 'imgpath' : 'img/' // directory with calendar images }; // date parsing function function f_tcalParseDate (s_date) { var re_date = /^\s*(\d{1,2})\/(\d{1,2})\/(\d{2,4})\s*$/; if (!re_date.exec(s_date)) return alert ("Invalid date: '" + s_date + "'.\nAccepted format is mm/dd/yyyy.") var n_day = Number(RegExp.$2), n_month = Number(RegExp.$1), n_year = Number(RegExp.$3); if (n_year < 100) n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900); if (n_month < 1 || n_month > 12) return alert ("Invalid month value: '" + n_month + "'.\nAllowed range is 01-12."); var d_numdays = new Date(n_year, n_month, 0); if (n_day > d_numdays.getDate()) return alert("Invalid day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + "."); return new Date (n_year, n_month - 1, n_day); } // date generating function function f_tcalGenerDate (d_date) { return ( (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "/" + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + "/" + d_date.getFullYear() ); } // implementation function tcal (a_cfg, a_tpl) { // apply default template if not specified if (!a_tpl) a_tpl = A_TCALDEF; // register in global collections if (!window.A_TCALS) window.A_TCALS = []; if (!window.A_TCALSIDX) window.A_TCALSIDX = []; this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length; window.A_TCALS[this.s_id] = this; window.A_TCALSIDX[window.A_TCALSIDX.length] = this; // assign methods this.f_show = f_tcalShow; this.f_hide = f_tcalHide; this.f_toggle = f_tcalToggle; this.f_update = f_tcalUpdate; this.f_relDate = f_tcalRelDate; this.f_parseDate = f_tcalParseDate; this.f_generDate = f_tcalGenerDate; // create calendar icon this.s_iconId = 'tcalico_' + this.s_id; this.e_icon = f_getElement(this.s_iconId); if (!this.e_icon) { document.write('<img src="' + a_tpl.imgpath + 'cal.gif" id="' + this.s_iconId + '" onclick="A_TCALS[\'' + this.s_id + '\'].f_toggle()" class="tcalIcon" alt="Open Calendar" />'); this.e_icon = f_getElement(this.s_iconId); } // save received parameters this.a_cfg = a_cfg; this.a_tpl = a_tpl; } function f_tcalShow (d_date) { // find input field if (!this.a_cfg.controlname) throw("TC: control name is not specified"); if (this.a_cfg.formname) { var e_form = document.forms[this.a_cfg.formname]; if (!e_form) throw("TC: form '" + this.a_cfg.formname + "' can not be found"); this.e_input = e_form.elements[this.a_cfg.controlname]; } else this.e_input = f_getElement(this.a_cfg.controlname); if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT') throw("TC: element '" + this.a_cfg.controlname + "' does not exist in " + (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document')); // dynamically create HTML elements if needed this.e_div = f_getElement('tcal'); if (!this.e_div) { this.e_div = document.createElement("DIV"); this.e_div.id = 'tcal'; document.body.appendChild(this.e_div); } this.e_shade = f_getElement('tcalShade'); if (!this.e_shade) { this.e_shade = document.createElement("DIV"); this.e_shade.id = 'tcalShade'; document.body.appendChild(this.e_shade); } this.e_iframe = f_getElement('tcalIF'); if (b_ieFix && !this.e_iframe) { this.e_iframe = document.createElement("IFRAME"); this.e_iframe.style.filter = 'alpha(opacity=0)'; this.e_iframe.id = 'tcalIF'; this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif'; document.body.appendChild(this.e_iframe); } // hide all calendars f_tcalHideAll(); // generate HTML and show calendar this.e_icon = f_getElement(this.s_iconId); if (!this.f_update()) return; this.e_div.style.visibility = 'visible'; this.e_shade.style.visibility = 'visible'; if (this.e_iframe) this.e_iframe.style.visibility = 'visible'; // change icon and status this.e_icon.src = this.a_tpl.imgpath + 'no_cal.gif'; this.e_icon.title = 'Close Calendar'; this.b_visible = true; } |
Цитата:
|
в новом окне браузера)
|
я не спрашивал в каком окне, я спросил что именно должно открыться в новом окне... Вы не высказали полностью свою проблему.
Цитата:
|
Часовой пояс GMT +3, время: 16:56. |