【发布时间】:2017-09-30 03:06:59
【问题描述】:
我正在尝试将 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没有任何价值。
标签: javascript nan