【问题标题】:Redirect from an HTML page to another page to a title从 HTML 页面重定向到另一个页面到标题
【发布时间】:2021-06-27 07:52:26
【问题描述】:

是否可以设置一个按钮链接来重定向到另一个页面的标题?

例如,在菜单中,我有“已实现项目”页面,并希望重定向到“欢迎”页面,我的作品集标题为“已实现项目”。是否可以使用我现在使用的脚本来做到这一点?

<script>
    setTimeout(function(){location.href="http://example.com/alternate_url.html"} , 0);
</script>

我需要这样的东西,但在加载页面后重定向:&lt;a href="http://example.com/alternate_url.html" title="test"&gt;test&lt;/a&gt;

这个问题有点棘手。但我使用的是糟糕的网站构建器,不会让我编辑按钮代码,让我只编辑 html 正文脚本:)

【问题讨论】:

    标签: html redirect script


    【解决方案1】:

    你可以use this

    喜欢

    <script>
        setTimeout(function(){location.replace("http://example.com/alternate_url.html");} , 0);
    </script>

    【讨论】:

      【解决方案2】:

      这行得通:)

      <script>
          setTimeout(function(){location.href="http://example.com/alternate_url.html",title="test"} , 0);
      </script>
      
      <h2 id="test">Title</h2>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-08-14
        • 2016-12-14
        • 1970-01-01
        • 1970-01-01
        • 2014-02-17
        • 1970-01-01
        • 2022-06-16
        • 2013-08-17
        相关资源
        最近更新 更多