For simplicity, I'm not going to show too much code, but the variables are set, and the following code is within a conditional. I'm just trying to show the var _offsetX and var _offsetY at the same time.
window.document.getElementById('cssposition').innerHTML = _offsetX _offsetY;
尝试:
window.document.getElementById('cssposition').innerHTML = _offsetX +" " + _offsetY;
只需使用+
运算符:
window.document.getElementById('cssposition').innerHTML = "X=" + _offsetX + " Y=" + _offsetY;
concat these two variables? ...innerHTML = "" + _offsetX + _offsetY;
Concatenate two variables and then try out, but make a note this a redundant way,
window.document.getElementById('cssposition').innerHTML=_offsetX.concat(_offsetY);
Note: This ignores the space
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.