Tag,
Vielleicht hilft dir das hier weiter?
Davon abgesehen, ichg weiss nicht, ob Du Eine Zuweisung so direkt in den a href schreiben kannst.
Pack das ganze in eine Funktion, etwa so
function jumpTo (anker) {
document.location.hash = anchor;
}
<a href="javascript:jumpTo('#top')">
(ohne Gewähr)
Viele Grüße,
Jörg