3. Dynamically alter a href tags on the fly based on the parameters gathered from the URL.
Don't do that. Or at least not as you have written it.
Instead, have the onclick
, alters/appends to include the querystring pairs, and then just does location.href = ...the altered url...
That way you have one function that can handle multiple <a> tags, doing the same thing for each.