This is available when the next view test is compatible under IE 11.
$ (window). Bind ('Beforeunload', Function (Event) { var_this = This; varx =Event. Originalevent.clientx; vary =Event. Originalevent.clienty; if(X >Event. currentTarget.document.body.clientWidth && Y <0||Event. Altkey) { //alert ("OK");$.post ("/admin/login/clearsesssion", Function (response) {//$ ("#myPnl"). HTML (response); }); }});
This seemingly simple to get coordinates function, but has spent my day, the day has been searching JS get coordinates, find a lot of many, one test, the result is incompatible. Really enough irritability, but things still want to continue, to complete, come back and continue to practice, search, repeated operation, found himself a lot of not ah, especially the jquery custom method (function), not at all, very lack of foundation, secretly determined to finish this study JS, otherwise always stuck in this respect. Although the time is long past, but I still did not give up, think of a keyword search, is not able to find what I want. Search "JS get coordinates compatible IE8", suddenly appeared after a few, so choose a practice, transformation, Kung Fu is not a conscientious, finally appeared I want results. Thanks to the network, thanks to the Netizen, solves the problem which bothers me day. Post the code found on the Web.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> The code I needed after my makeover
Press CTRL + C to copy the code<textarea></textarea>Press CTRL + C to copy the codeThe following IE7,IE8 is not compatible and some browsers can
function Getpostion (e) {
var x = GetX (e);
var y = GetY (e);
}
function GetX (e) {
E = e | | window.event;
return E.pagex | | E.clientx + document.body.scroolLeft;
}
function GetY (e) {
E = e| | window.event;
return E.pagey | | E.clienty + Document.boyd.scrollTop;
}
To summarize, the information retrieval is really important, is to learn to ask questions, search for keywords.
Transferred from: http://www.cnblogs.com/annabook/p/4506614.html
JS get mouse coordinate position compatible with multiple browsers