Originally Posted by Old Pedant
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.
I think this will work.
About the element ID, its not needed. I dont know what the (e) is for either...
Ill play around with this. I was not aware you could append and onlick event to a href like this. I think this will work perfectly.
Thanks so much OP!