<!-- calendar attaches to existing form element --> <input type="text" name="testinput" /> <script language="JavaScript"> new tcal ({ // form name 'formname': 'testform', // input name 'controlname': 'testinput' });
</script> </form>
</body> </html>
а вот calendar.js:
var A_TCALDEF = { 'months' : ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'], 'weekdays' : ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Нд'], 'yearscroll': true, // show year scroller 'weekstart': 0, // first day of week: 0-Пн or 1-Вт '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 = [];
// 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;
// figure out date to display if (!d_date) // selected by default d_date = d_selected; else if (typeof(d_date) == 'number') // get from number d_date = f_tcalResetTime(new Date(d_date)); else if (typeof(d_date) == 'string') // parse from string this.f_parseDate(d_date);
if (!d_date) return false;
// first date to display var d_firstday = new Date(d_date); d_firstday.setDate(1); d_firstday.setDate(1 - (7 + d_firstday.getDay() - this.a_tpl.weekstart) % 7);
f_getElement = document.all ? function (s_id) { return document.all[s_id] } : function (s_id) { return document.getElementById(s_id) };
if (document.addEventListener) window.addEventListener('scroll', f_tcalHideAll, false); if (window.attachEvent) window.attachEvent('onscroll', f_tcalHideAll);
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Здравствуйте, подскажите какой тег использовать для увеличения значения, пример на картинке.
Вроде, про такой тег я слышала. Если есть тег прогресс бар, значит и такое должно быть.
Question
Alex&R
Есть такой вот календарь tigra calendar.
Скрипт календаря находется по адресу: js/calendar/calendar.js, изображния js/calendar/img.
В корене лежит ХТМЛ документ index.html
Код index.html
а вот calendar.js:
Не отображается только изображение cal.gif. В чем проблема?
Edited by Alex&RLink to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.