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;
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;
Share
Improve this question
asked Sep 10, 2012 at 20:57
William SmithWilliam Smith
8521 gold badge13 silver badges23 bronze badges
2
-
Any reason you can't just use
console.log(_offsetX, _offsetY)
? Looks like you're just debugging to me. – zzzzBov Commented Sep 10, 2012 at 21:00 - window.document.getElementById('cssposition').innerHTML = _offsetX +''+_offsetY; – Shahrokhian Commented Sep 10, 2012 at 21:04
4 Answers
Reset to default 3try:
window.document.getElementById('cssposition').innerHTML = _offsetX +" " + _offsetY;
Just use the +
operator:
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