P
Peter Afonin
Hello,
I'm using the javascript Calendar in my aspx pages. I'm having troubles
using it with the Master-Content pages.
In the regular aspx page I'm referring to the textbox like this:
var cal2 = new calendar2(document.forms['form1'].elements['txtEndDate']);
Obviously, this doesn't work in the Content page. In the source of this page
the textbox looks like this:
ctl00_ContentPlaceHolder1_txtEndDate
So I tried to use it. This works fine if I refer to the control directly,
like this:
ctl00_ContentPlaceHolder1_txtEndDate.focus(); instead of
document.form1.txtEndDate.focus();
However, in the javascript function it still doesn't work:
var cal2 = new calendar2(ctl00_ContentPlaceHolder1_txtEndDate);
gives me a message that control ctl00_ContentPlaceHolder1_txtEndDate is
undefuned.
Just in case, here is the function calendar2:
function calendar2(obj_target) {
// assing methods
this.gen_date = cal_gen_date2;
this.gen_time = cal_gen_time2;
this.gen_tsmp = cal_gen_tsmp2;
this.prs_date = cal_prs_date2;
this.prs_time = cal_prs_time2;
this.prs_tsmp = cal_prs_tsmp2;
this.popup = cal_popup2;
// validate input parameters
if (!obj_target)
return cal_error("Error calling the calendar: no target control
specified");
if (obj_target.value == null)
return cal_error("Error calling the calendar: parameter specified is not
valid tardet control");
this.target = obj_target;
this.time_comp = BUL_TIMECOMPONENT;
this.year_scroll = BUL_YEARSCROLL;
// register in global collections
this.id = calendars.length;
calendars[this.id] = this;
}
Does anyone knows what is the trick here, how should I refer to this control
in the js function? I'm not an expert in js and would appreciate your
comments.
Thank you.
I'm using the javascript Calendar in my aspx pages. I'm having troubles
using it with the Master-Content pages.
In the regular aspx page I'm referring to the textbox like this:
var cal2 = new calendar2(document.forms['form1'].elements['txtEndDate']);
Obviously, this doesn't work in the Content page. In the source of this page
the textbox looks like this:
ctl00_ContentPlaceHolder1_txtEndDate
So I tried to use it. This works fine if I refer to the control directly,
like this:
ctl00_ContentPlaceHolder1_txtEndDate.focus(); instead of
document.form1.txtEndDate.focus();
However, in the javascript function it still doesn't work:
var cal2 = new calendar2(ctl00_ContentPlaceHolder1_txtEndDate);
gives me a message that control ctl00_ContentPlaceHolder1_txtEndDate is
undefuned.
Just in case, here is the function calendar2:
function calendar2(obj_target) {
// assing methods
this.gen_date = cal_gen_date2;
this.gen_time = cal_gen_time2;
this.gen_tsmp = cal_gen_tsmp2;
this.prs_date = cal_prs_date2;
this.prs_time = cal_prs_time2;
this.prs_tsmp = cal_prs_tsmp2;
this.popup = cal_popup2;
// validate input parameters
if (!obj_target)
return cal_error("Error calling the calendar: no target control
specified");
if (obj_target.value == null)
return cal_error("Error calling the calendar: parameter specified is not
valid tardet control");
this.target = obj_target;
this.time_comp = BUL_TIMECOMPONENT;
this.year_scroll = BUL_YEARSCROLL;
// register in global collections
this.id = calendars.length;
calendars[this.id] = this;
}
Does anyone knows what is the trick here, how should I refer to this control
in the js function? I'm not an expert in js and would appreciate your
comments.
Thank you.