document.onscroll = getScrollPos;
var scrollPosition = document.body.scrollTop; // initial value
function getScrollPos(e) /* what is the point of e here? */
/* you don't show what element has id="scrollposition" or why
so I left it alone...but it may or may not be needed */
<a href="somePage.asp?scrollPosition=" onclick="this.href += scrollPosition; return true;">
go do it
Is that what you mean?
N.B.: In JS (and C and C++ and Java and ...) when you do
a = b = c = d
the assignment operations proceed right to left. So d is assigned to c which is assigned to b which is assigned to a.