原文: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)
            }
        }

 

网页结构:

Layui 在新标签中打开页面 / 模拟点击菜单

 

 

测试页面:

<!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>

 

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2021-08-24
  • 2021-06-12
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-17
  • 2022-01-02
  • 2022-12-23
  • 2021-11-17
  • 2021-07-26
  • 2021-11-23
  • 2021-11-17
相关资源
相似解决方案