Sorry! same results "Undefined".
I have check this code on many PCs, but same results appear.

document.write(var1);//////this line is working fine

Through this code, i want to take input using Javascript and an HTML textbox.
I think there is something else, which is missing in this code.