mardi 26 mars 2019

In the smarty code, the a tag href do not redirect to the target

the below is a part of smarty site code:

...
<script>
    function redirect_home(){
        window.location.href="www.ddes2.com";
    }
</script>
<body>
    <nav style="background-color:#000;">
        <ul class="layui-nav layui-main text-right" style="background-color: #000!important;">
          <li class="layui-nav-item"><a href="javascript:;" onclick="redirect_home()"><span>Home</span></a></li>
          {[if !$is_add_money]}
          <li class="layui-nav-item layui-nav-right"><a href="?c=session&a=loginForm"><span>Login</span></a></li>
          {[/if]}
        </ul>
    </nav>

the site domain is www.example.com.

You see my code: <li class="layui-nav-item"><a href="javascript:;" onclick="redirect_home()"><span>Home</span></a></li>, there I write a function I want to redirect to www.ddes2.com, but when I click the a tag, it's location goes to: www.example.com/www.ddes2.com.

how can I use the smarty a tag to redirect to an absolute URL?




Aucun commentaire:

Enregistrer un commentaire