I am trying to create a div using javascript document.write() in a specified position .
This gives correct answer
document.write("<div style='position: absolute; left:200px; top:100px;'<h1 style='font-size:10px; color:blue;'> HELLO WORLD<h1></div>");
but whenever I use a javascript variable in top and left, left gives correct position but top don't
document.write("<div style='position: absolute; left: " + left + "px; top: " + top + "px;'>" + " <h1 style='font-size:10px; color:blue;'> HELLO WORLD<h1></div>");
How can I use a javascript variable in top?