Я работаю над рабочим веб-сайтом, на котором есть поле ввода даты и таблица результатов, основанная на дате, введенной в это поле. Там также есть ссылка на средство выбора даты в календаре, которым я не пользуюсь. Когда дата вводится вручную, таблица результатов изменяется динамически. Он меняется сразу после ввода новой даты, поэтому я попытался найти событие onchange, которое я мог бы запустить после изменения поля даты. Я не могу найти это событие, но я нашел на той же странице несколько javascript, которые, кажется, связаны с датой, введенной в поле.
Как мне автоматизировать это поведение onchange без события onchange в html?
РЕДАКТИРОВАТЬ: В ответ на Zwenn и другие, которые задаются вопросом о VBA, который я использовал: у меня нет его для этой части моего макроса, потому что нет события onchange для запуска. Я только попытался изменить значение поля с помощью:
iedoc.document.all.radUpToDatePicker.value = strFormattedDateValue
iedoc.document.all.radUpToDatePicker_dateInput.value = strDateVAlue
Как я уже упоминал в другом вопросе (который я попытался упростить, повторно задав здесь), это работает для изменения значений, но не приводит при изменении базовой таблицы, как это происходит при вводе вручную.
HTML за полем даты:
<td>
<div id="radUpToDatePicker_wrapper" class="RadPicker RadPicker_Default" style="display:inline-block;width:160px;">
<!-- 2012.3.1016.40 --><input style="visibility:hidden;display:block;float:right;margin:0 0 -1px -1px;width:1px;height:1px;overflow:hidden;border:0;padding:0;" id="radUpToDatePicker" name="radUpToDatePicker" type="text" class="rdfd_" value="2020-06-16" title="Visually hidden input created for functionality purposes." />
<table cellspacing="0" class="rcTable rcSingle" summary="Table holding date picker control for selection of dates." style="width:100%;">
<caption style="display:none;"> RadDatePicker </caption>
<tr>
<td class="rcInputCell" style="width:100%;"><span id="radUpToDatePicker_dateInput_wrapper" class="riSingle RadInput RadInput_Default" style="display:block;width:100%;"><input id="radUpToDatePicker_dateInput" name="radUpToDatePicker$dateInput" class="riTextBox riEnabled" value="16/06/2020" type="text" /><input id="radUpToDatePicker_dateInput_ClientState" name="radUpToDatePicker_dateInput_ClientState" type="hidden" /></span></td>
<td><a title="Open the calendar popup." href="#" id="radUpToDatePicker_popupButton" class="rcCalPopup">Open the calendar popup.</a>
<div id="radUpToDatePicker_calendar_wrapper" style="display: none">
<table id="radUpToDatePicker_calendar" summary="Calendar control which enables the selection of dates." cellspacing="0" class="RadCalendar RadCalendar_Default" border="0">
<caption>
<span style='display:none;'>Calendar</span>
</caption>
<thead>
<tr>
<td class="rcTitlebar">
<table cellspacing="0" summary="Title and navigation which can change and show the current year and month." border="0">
<caption>
<span style='display:none;'>Title and navigation</span>
</caption>
<thead>
<tr>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<tr>
<td><a id="radUpToDatePicker_calendar_FNP" class="rcFastPrev" title="<<" href="#"><<</a></td>
<td><a id="radUpToDatePicker_calendar_NP" class="rcPrev" title="<" href="#"><</a></td>
<td id="radUpToDatePicker_calendar_Title" class="rcTitle">June 2020</td>
<td><a id="radUpToDatePicker_calendar_NN" class="rcNext" title=">" href="#">></a></td>
<td><a id="radUpToDatePicker_calendar_FNN" class="rcFastNext" title=">>" href="#">>></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</thead>
<tbody>
<tr>
<td class="rcMain">
<table id="radUpToDatePicker_calendar_Top" class="rcMainTable" cellspacing="0" summary="Table containing all dates for the currently selected month." border="0">
<caption>
<span style='display:none;'>June 2020</span>
</caption>
<thead>
<tr class="rcWeek">
<th class="rcViewSel" scope="col"> </th>
<th id="radUpToDatePicker_calendar_Top_cs_1" title="Monday" scope="col" abbr="Mon">M</th>
<th id="radUpToDatePicker_calendar_Top_cs_2" title="Tuesday" scope="col" abbr="Tue">T</th>
<th id="radUpToDatePicker_calendar_Top_cs_3" title="Wednesday" scope="col" abbr="Wed">W</th>
<th id="radUpToDatePicker_calendar_Top_cs_4" title="Thursday" scope="col" abbr="Thu">T</th>
<th id="radUpToDatePicker_calendar_Top_cs_5" title="Friday" scope="col" abbr="Fri">F</th>
<th id="radUpToDatePicker_calendar_Top_cs_6" title="Saturday" scope="col" abbr="Sat">S</th>
<th id="radUpToDatePicker_calendar_Top_cs_7" title="Sunday" scope="col" abbr="Sun">S</th>
</tr>
</thead>
<tbody>
<tr class="rcRow">
<th id="radUpToDatePicker_calendar_Top_rs_1" scope="row">22</th>
<td class="rcOtherMonth" title="Monday, May 25, 2020"><a href="#">25</a></td>
<td class="rcOtherMonth" title="Tuesday, May 26, 2020"><a href="#">26</a></td>
<td class="rcOtherMonth" title="Wednesday, May 27, 2020"><a href="#">27</a></td>
<td class="rcOtherMonth" title="Thursday, May 28, 2020"><a href="#">28</a></td>
<td class="rcOtherMonth" title="Friday, May 29, 2020"><a href="#">29</a></td>
<td class="rcOtherMonth" title="Saturday, May 30, 2020"><a href="#">30</a></td>
<td class="rcOtherMonth" title="Sunday, May 31, 2020"><a href="#">31</a></td>
</tr>
<tr class="rcRow">
<th id="radUpToDatePicker_calendar_Top_rs_2" scope="row">23</th>
<td title="Monday, June 01, 2020"><a href="#">1</a></td>
<td title="Tuesday, June 02, 2020"><a href="#">2</a></td>
<td title="Wednesday, June 03, 2020"><a href="#">3</a></td>
<td title="Thursday, June 04, 2020"><a href="#">4</a></td>
<td title="Friday, June 05, 2020"><a href="#">5</a></td>
<td class="rcWeekend" title="Saturday, June 06, 2020"><a href="#">6</a></td>
<td class="rcWeekend" title="Sunday, June 07, 2020"><a href="#">7</a></td>
</tr>
<tr class="rcRow">
<th id="radUpToDatePicker_calendar_Top_rs_3" scope="row">24</th>
<td title="Monday, June 08, 2020"><a href="#">8</a></td>
<td title="Tuesday, June 09, 2020"><a href="#">9</a></td>
<td title="Wednesday, June 10, 2020"><a href="#">10</a></td>
<td title="Thursday, June 11, 2020"><a href="#">11</a></td>
<td title="Friday, June 12, 2020"><a href="#">12</a></td>
<td class="rcWeekend" title="Saturday, June 13, 2020"><a href="#">13</a></td>
<td class="rcWeekend" title="Sunday, June 14, 2020"><a href="#">14</a></td>
</tr>
<tr class="rcRow">
<th id="radUpToDatePicker_calendar_Top_rs_4" scope="row">25</th>
<td title="Monday, June 15, 2020"><a href="#">15</a></td>
<td title="Tuesday, June 16, 2020"><a href="#">16</a></td>
<td title="Wednesday, June 17, 2020"><a href="#">17</a></td>
<td title="Thursday, June 18, 2020"><a href="#">18</a></td>
<td title="Friday, June 19, 2020"><a href="#">19</a></td>
<td class="rcWeekend" title="Saturday, June 20, 2020"><a href="#">20</a></td>
<td class="rcWeekend" title="Sunday, June 21, 2020"><a href="#">21</a></td>
</tr>
<tr class="rcRow">
<th id="radUpToDatePicker_calendar_Top_rs_5" scope="row">26</th>
<td title="Monday, June 22, 2020"><a href="#">22</a></td>
<td title="Tuesday, June 23, 2020"><a href="#">23</a></td>
<td title="Wednesday, June 24, 2020"><a href="#">24</a></td>
<td title="Thursday, June 25, 2020"><a href="#">25</a></td>
<td title="Friday, June 26, 2020"><a href="#">26</a></td>
<td class="rcWeekend" title="Saturday, June 27, 2020"><a href="#">27</a></td>
<td class="rcWeekend" title="Sunday, June 28, 2020"><a href="#">28</a></td>
</tr>
<tr class="rcRow">
<th id="radUpToDatePicker_calendar_Top_rs_6" scope="row">27</th>
<td title="Monday, June 29, 2020"><a href="#">29</a></td>
<td title="Tuesday, June 30, 2020"><a href="#">30</a></td>
<td class="rcOtherMonth" title="Wednesday, July 01, 2020"><a href="#">1</a></td>
<td class="rcOtherMonth" title="Thursday, July 02, 2020"><a href="#">2</a></td>
<td class="rcOtherMonth" title="Friday, July 03, 2020"><a href="#">3</a></td>
<td class="rcOtherMonth" title="Saturday, July 04, 2020"><a href="#">4</a></td>
<td class="rcOtherMonth" title="Sunday, July 05, 2020"><a href="#">5</a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
javascript Я обнаружил, что имеет какое-то отношение к этому (поскольку он ссылается на дату), но я не могу понять. *
<script type="text/javascript">
//<![CDATA[
Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadDateInput, {
"_displayText": "16/06/2020",
"_focused": false,
"_initialValueAsText": "2020-06-16-00-00-00",
"_postBackEventReferenceScript": "__doPostBack(\u0027radUpToDatePicker\u0027,\u0027\u0027)",
"_skin": "Default",
"_validationText": "2020-06-16-00-00-00",
"autoPostBack": true,
"clientStateFieldID": "radUpToDatePicker_dateInput_ClientState",
"dateFormat": "dd/MM/yyyy",
"dateFormatInfo": {
"DayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
"MonthNames": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""],
"AbbreviatedDayNames": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
"AbbreviatedMonthNames": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""],
"AMDesignator": "AM",
"PMDesignator": "PM",
"DateSeparator": "/",
"TimeSeparator": ":",
"FirstDayOfWeek": 1,
"DateSlots": {
"Month": 1,
"Day": 0,
"Year": 2
},
"ShortYearCenturyEnd": 2029,
"TimeInputOnly": false
},
"displayDateFormat": "dd/MM/yyyy",
"enabled": true,
"incrementSettings": {
InterceptArrowKeys: true,
InterceptMouseWheel: true,
Step: 1
},
"styles": {
HoveredStyle: ["width:100%;", "riTextBox riHover"],
InvalidStyle: ["width:100%;", "riTextBox riError"],
DisabledStyle: ["width:100%;", "riTextBox riDisabled"],
FocusedStyle: ["width:100%;", "riTextBox riFocused"],
EmptyMessageStyle: ["width:100%;", "riTextBox riEmpty"],
ReadOnlyStyle: ["width:100%;", "riTextBox riRead"],
EnabledStyle: ["width:100%;", "riTextBox riEnabled"]
}
}, null, null, $get("radUpToDatePicker_dateInput"));
});
Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadCalendar, {
"_DayRenderChangedDays": {},
"_FormatInfoArray": [
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""],
["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], "dd MMMM yyyy HH:mm:ss", "dd MMMM yyyy", "HH:mm:ss", "d MMMM", "ddd, dd MMM yyyy HH\u0027:\u0027mm\u0027:\u0027ss \u0027GMT\u0027", "dd/MM/yyyy", "HH:mm", "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss", "yyyy\u0027-\u0027MM\u0027-\u0027dd HH\u0027:\u0027mm\u0027:\u0027ss\u0027Z\u0027", "MMMM yyyy", "AM", "PM", "/", ":", 1
],
"_ViewRepeatableDays": {},
"_ViewsHash": {
"radUpToDatePicker_calendar_Top": [
[2020, 6, 1], 1
]
},
"_calendarWeekRule": 2,
"_culture": "en-GB",
"_enableKeyboardNavigation": false,
"_enableViewSelector": false,
"_firstDayOfWeek": 7,
"_postBackCall": "__doPostBack(\u0027radUpToDatePicker$calendar\u0027,\u0027@@\u0027)",
"_rangeSelectionMode": 0,
"clientStateFieldID": "radUpToDatePicker_calendar_ClientState",
"enableMultiSelect": false,
"enabled": true,
"monthYearNavigationSettings": ["Today", "OK", "Cancel", "Date is out of range.", "False", "True", "300", "1", "300", "1", "False"],
"skin": "Default",
"specialDaysArray": [],
"stylesHash": {
"DayStyle": ["", ""],
"CalendarTableStyle": ["", "rcMainTable"],
"OtherMonthDayStyle": ["", "rcOtherMonth"],
"TitleStyle": ["", ""],
"SelectedDayStyle": ["", "rcSelected"],
"SelectorStyle": ["", ""],
"DisabledDayStyle": ["", "rcDisabled"],
"OutOfRangeDayStyle": ["", "rcOutOfRange"],
"WeekendDayStyle": ["", "rcWeekend"],
"DayOverStyle": ["", "rcHover"],
"FastNavigationStyle": ["", "RadCalendarMonthView RadCalendarMonthView_Default"],
"ViewSelectorStyle": ["", "rcViewSel"]
},
"useColumnHeadersAsSelectors": false,
"useRowHeadersAsSelectors": false
}, null, null, $get("radUpToDatePicker_calendar"));
});
Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadDatePicker, {
"_PopupButtonSettings": {
ResolvedImageUrl: "",
ResolvedHoverImageUrl: ""
},
"_animationSettings": {
ShowAnimationDuration: 300,
ShowAnimationType: 1,
HideAnimationDuration: 0,
HideAnimationType: 1
},
"_popupControlID": "radUpToDatePicker_popupButton",
"clientStateFieldID": "radUpToDatePicker_ClientState",
"focusedDate": "2020-06-16-00-00-00"
}, null, {
"calendar": "radUpToDatePicker_calendar",
"dateInput": "radUpToDatePicker_dateInput"
}, $get("radUpToDatePicker"));
});
Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadDateInput, {
"_displayText": "11/06/2020",
"_focused": false,
"_initialValueAsText": "2020-06-11-00-00-00",
"_postBackEventReferenceScript": "__doPostBack(\u0027radFromDatePicker\u0027,\u0027\u0027)",
"_skin": "Default",
"_validationText": "2020-06-11-00-00-00",
"autoPostBack": true,
"clientStateFieldID": "radFromDatePicker_dateInput_ClientState",
"dateFormat": "dd/MM/yyyy",
"dateFormatInfo": {
"DayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
"MonthNames": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""],
"AbbreviatedDayNames": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
"AbbreviatedMonthNames": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""],
"AMDesignator": "AM",
"PMDesignator": "PM",
"DateSeparator": "/",
"TimeSeparator": ":",
"FirstDayOfWeek": 1,
"DateSlots": {
"Month": 1,
"Day": 0,
"Year": 2
},
"ShortYearCenturyEnd": 2029,
"TimeInputOnly": false
},
"displayDateFormat": "dd/MM/yyyy",
"enabled": true,
"incrementSettings": {
InterceptArrowKeys: true,
InterceptMouseWheel: true,
Step: 1
},
"styles": {
HoveredStyle: ["width:100%;", "riTextBox riHover"],
InvalidStyle: ["width:100%;", "riTextBox riError"],
DisabledStyle: ["width:100%;", "riTextBox riDisabled"],
FocusedStyle: ["width:100%;", "riTextBox riFocused"],
EmptyMessageStyle: ["width:100%;", "riTextBox riEmpty"],
ReadOnlyStyle: ["width:100%;", "riTextBox riRead"],
EnabledStyle: ["width:100%;", "riTextBox riEnabled"]
}
}, null, null, $get("radFromDatePicker_dateInput"));
});
Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadCalendar, {
"_DayRenderChangedDays": {},
"_FormatInfoArray": [
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""],
["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], "dd MMMM yyyy HH:mm:ss", "dd MMMM yyyy", "HH:mm:ss", "d MMMM", "ddd, dd MMM yyyy HH\u0027:\u0027mm\u0027:\u0027ss \u0027GMT\u0027", "dd/MM/yyyy", "HH:mm", "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss", "yyyy\u0027-\u0027MM\u0027-\u0027dd HH\u0027:\u0027mm\u0027:\u0027ss\u0027Z\u0027", "MMMM yyyy", "AM", "PM", "/", ":", 1
],
"_ViewRepeatableDays": {},
"_ViewsHash": {
"radFromDatePicker_calendar_Top": [
[2020, 6, 1], 1
]
},
"_calendarWeekRule": 2,
"_culture": "en-GB",
"_enableKeyboardNavigation": false,
"_enableViewSelector": false,
"_firstDayOfWeek": 7,
"_postBackCall": "__doPostBack(\u0027radFromDatePicker$calendar\u0027,\u0027@@\u0027)",
"_rangeSelectionMode": 0,
"clientStateFieldID": "radFromDatePicker_calendar_ClientState",
"enableMultiSelect": false,
"enabled": true,
"monthYearNavigationSettings": ["Today", "OK", "Cancel", "Date is out of range.", "False", "True", "300", "1", "300", "1", "False"],
"skin": "Default",
"specialDaysArray": [],
"stylesHash": {
"DayStyle": ["", ""],
"CalendarTableStyle": ["", "rcMainTable"],
"OtherMonthDayStyle": ["", "rcOtherMonth"],
"TitleStyle": ["", ""],
"SelectedDayStyle": ["", "rcSelected"],
"SelectorStyle": ["", ""],
"DisabledDayStyle": ["", "rcDisabled"],
"OutOfRangeDayStyle": ["", "rcOutOfRange"],
"WeekendDayStyle": ["", "rcWeekend"],
"DayOverStyle": ["", "rcHover"],
"FastNavigationStyle": ["", "RadCalendarMonthView RadCalendarMonthView_Default"],
"ViewSelectorStyle": ["", "rcViewSel"]
},
"useColumnHeadersAsSelectors": false,
"useRowHeadersAsSelectors": false
}, null, null, $get("radFromDatePicker_calendar"));
});
Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadDatePicker, {
"_PopupButtonSettings": {
ResolvedImageUrl: "",
ResolvedHoverImageUrl: ""
},
"_animationSettings": {
ShowAnimationDuration: 300,
ShowAnimationType: 1,
HideAnimationDuration: 0,
HideAnimationType: 1
},
"_popupControlID": "radFromDatePicker_popupButton",
"clientStateFieldID": "radFromDatePicker_ClientState",
"focusedDate": "2020-06-16-00-00-00"
}, null, {
"calendar": "radFromDatePicker_calendar",
"dateInput": "radFromDatePicker_dateInput"
}, $get("radFromDatePicker"));
});
//]]>
</script>
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
// telerik controls are not registered on a javascript window.onload, so wait a little while first.
setTimeout("setRadioButtonState()", 200);
</script>