Layui 在新標簽中打開頁面 / 模擬點擊菜單


原文:https://blog.csdn.net/sr_www/article/details/81394365

 

 

核心代碼:

        //在新標簽頁中 打開頁面
        function newTab(url, tit) {
            if (top.layui.index) {
                top.layui.index.openTabsPage(url, tit)
            } else {
                window.open(url)
            }
        }

 

網頁結構:

 

 

測試頁面:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>

    <script type="text/javascript">

        //https://blog.csdn.net/sr_www/article/details/81394365

        //在新標簽頁中 打開頁面
        function newTab(url, tit) {
            if (top.layui.index) {
                top.layui.index.openTabsPage(url, tit)
            } else {
                window.open(url)
            }
        }
    </script>


    <a href="javascript:newTab('HtmlPage5.html','詳情')" class="layui-btn layui-btn-sm">查看</a>


    <h1>html4</h1>

</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM