Passing Javascript variable to

后端 未结 8 728
野趣味
野趣味 2020-11-28 04:07

HTML Part:


 this i         


        
相关标签:
8条回答
  • 2020-11-28 04:42
    <script>
       var scrt_var = 10;
       document.getElementById("link").setAttribute("href",scrt_var);
    </script>
    <a id="link">this is a link</a>
    
    0 讨论(0)
  • 2020-11-28 04:47

    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.

    0 讨论(0)
提交回复
热议问题