<script>
var scrt_var = 10;
document.getElementById("link").setAttribute("href",scrt_var);
</script>
<a id="link">this is a link</a>
If you use internationalization (i18n), and after switch to another language, something like ?locale=fror ?fr might be added at the end of the url. But when you go to another page on click event, translation switch wont be stable.
For this kind of cases a DOM click event handler function must be produced to handle all the a.href attributes by storing the switch state as a variable and add it to all a tags’ tail.