我想从对方减去2个整数,但我仍然得到NaN
。 谁能请解释一下什么是错我的代码2个数相减得到一个NaN?
var moveit = null;
p = function (e){
if ((e.target.id == "windowContainer") || (e.target.id ==
"windowContainer2") || (e.target.id == "windowContainer3")){
console.log (e);
window.moveit = e.target;
window.onmousemove = p2;
var r = window.moveit.getBoundingClientRect();
var rl = r.left;
var rt = r.top;
window.onmouseup = function (e){
if (window.moveit == null) return;
window.moveit.onmousemove = window.moveit = null;
}
}
}
p2 = function (e, rt, epageY){
if (window.moveit == null) return;
var newY = rt - e.pageY;
console.log(isNaN(newY));
}
document.getElementById('windowContainer').onmousedown = p;
document.getElementById('windowContainer2').onmousedown = p;
document.getElementById('windowContainer3').onmousedown = p;
为什么你认为你有两个整数? 'rt'没有任何价值。 – SLaks