[英]Find event on cell click Javascript
我有一个日历控件,其中填充了Page_Load事件。 当用户单击一个单元格时,我想在该单元格中找到事件,然后用信息填充文本区域。
当他们单击单元格时,我可以使Click事件发生,但是我不知道如何获取该事件并在Java文本区域中显示。
<DayPilot:DayPilotMonth CssClassPrefix="bsimplexcalender"
OnCommand="calender_control_Command"
ContextMenuID="menu"
EventRightClickHandling="ContextMenu"
EventRightClickJavaScript="select(e)"
BubbleID="DayPilotBubble1"
ClientObjectName="dpm"
runat="server"
ID="calender_control"
Theme="bsimplexcalender"
HeightSpec="Auto" Height="0"
MinCellHeight="63"
DataStartField="start"
DataEndField="end"
DataTextField="name"
DataValueField="id"
OnBeforeEventRender="calender_control_BeforeEventRender"
TimeRangeSelectedHandling="JavaScript"
TimeRangeSelectedJavaScript="''THIS IS THE CLICK EVENT I NEED TO FIND EVENT AND DISPLAY HERE" />
此代码可能会有所帮助:
对于JavaScript:
function loadCalendarEvent(day) { //call this function when table cell is clicked
//in var day pass the day clicked
var xmlhttp;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
//just received the answer from server so do something with it here
}
}
var url; //link to php file
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Content-Type", "text/json"); //change Content-Type to what you need
xmlhttp.send(day);
}
对于PHP:
<?php
$ClientData = file_get_contents('php://input'); //day variable is stored here
//query database for event and save it to some variable
echo $thatVariable;
?>
如果您想让我解释更多,请发表评论...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.