Effect 1. When the mouse is placed on a day, if there is a memo on the day, it will be displayed, the following figure:
Copy Code code as follows:
function Checkfortasks (Thedate, E) {
Find Taskbox <div> set to visible in page
Theobject = document.getElementById ("Taskbox");
theObject.style.visibility = "visible";
Initialize Taskbox position
var posx = 0;
var posy = 0;
Locate Taskbox position as mouse position
POSX = E.clientx + document.body.scrollLeft;
Posy = E.clienty + document.body.scrollTop;
TheObject.style.left = posx + "px";
TheObject.style.top = posy + "px";
Set up the PHP request page
Serverpage = "taskchecker.php?thedate=" + thedate;
Set PHP return Data replacement location
ObjID = "Taskbox";
var obj = document.getElementById (ObjID);
Send request and load return data
Xmlhttp.open ("Get", serverpage);
Xmlhttp.onreadystatechange = function () {
if (xmlhttp.readystate = = 4 && xmlhttp.status = 200) {
obj.innerhtml = Xmlhttp.responsetext;
}
}
Xmlhttp.send (NULL);
}
Effect 2. When the mouse clicks on a day to enter the name, the system will automatically retrieve the existence of the name, and can be filled in the Name box, as shown:
Copy Code code as follows:
Function AutoComplete (Thevalue, E) {
Locate the <div> position of the Autocompletediv in the page (showing the label that retrieves the name)
Theobject = document.getElementById ("Autocompletediv");
Set to visible
theObject.style.visibility = "visible";
TheObject.style.width = "152px";
Set Retrieve label location
var posx = 0;
var posy = 0;
Posx = (Findposx (document.getElementById ("yourname")) + 1);
Posy = (Findposy (document.getElementById ("yourname")) + 23);
TheObject.style.left = posx + "px";
TheObject.style.top = posy + "px";
Setting Events for keyboard entry
var Theextrachar = E.which;
if (Theextrachar = = undefined) {
Theextrachar = E.keycode;
}
Set Load Search list location
var ObjID = "Autocompletediv";
Set the PHP request page and pass the user's name to the past (taking into account the backspace effect)
if (Theextrachar = = 8) {
if (thevalue.length = = 1) {
var serverpage = "autocomp.php";
}
else{
var serverpage = "autocomp.php" + "sstring=" + thevalue.substr (0, (thevalue.length-1));
}
}
else{
var serverpage = "autocomp.php" + "? sstring=" + Thevalue + string.fromcharcode (Theextrachar);
}
Send request and load return data
var obj = document.getElementById (ObjID);
Xmlhttp.open ("Get", serverpage);
Xmlhttp.onreadystatechange = function () {
if (xmlhttp.readystate = = 4 && xmlhttp.status = 200) {
obj.innerhtml = Xmlhttp.responsetext;
}
}
Xmlhttp.send (NULL);
}
File package Download