Sorry! same results "Undefined".
I have check this code on many PCs, but same results appear.
document.write(var1);//////this line is working fine
I think there is something else, which is missing in this code.