The problem is not with the passing of the variable but its the problem with the printing of value in the document.

Try doing this and all should be fine
Code:
document.write("<PRE>")
document.write(refno) ' The result will be 1234&abcde and not 1234
document.write("</PRE>")
Happy coding.