【问题标题】:Linking to local subdomains链接到本地​​子域
【发布时间】:2023-03-17 21:32:01
【问题描述】:

我为我的网站制作了一个导航栏,它有三个页面,都在同一个目录中。

  1. index.php 有 2 个部分:#donate#info

  2. quiz.html 只是一页。

  3. contact.html 只是一页。

    index.php 我的导航栏完美运行。代码如下:

<div class="w3-bar w3-black w3-card">
    <a class="w3-bar-item w3-button w3-padding-large w3-hide-medium w3-hide-large w3-right" href="javascript:void(0)" onclick="myFunction()" title="Toggle Navigation Menu"><i class="fa fa-bars"></i></a>
    <a href="#" class="w3-bar-item w3-button w3-padding-large"><strong>HOME</strong></a>
    <a href="/quiz.html" class="w3-bar-item w3-button w3-padding-large w3-hide-small">QUESTIONAIRRE</a>
    <div class="w3-dropdown-hover w3-hide-small">
      <button class="w3-padding-large w3-button" title="More">MORE <i class="fa fa-caret-down"></i></button>     
      <div class="w3-dropdown-content w3-bar-block w3-card-4">
        <a href="#info" class="w3-bar-item w3-button">INFO</a>
        <a href="/contact.html" class="w3-bar-item w3-button">CONTACT</a>
        <a href="#donate" class="w3-bar-item w3-button">DONATE</a>
      </div>
    </div>
  </div>

但是当我在quiz.html 上使用导航栏时,当我点击“DONATE”或“CONTACT”时,它不起作用 - 即使“INFO”具有相同的语法,它也会将我带到quiz.html#,并且作品。这是quiz.html的导航栏的代码:

<div class="w3-bar w3-black w3-card">
            <a class="w3-bar-item w3-button w3-padding-large w3-hide-medium w3-hide-large w3-right" href="javascript:void(0)" onclick="myFunction()" title="Toggle Navigation Menu"><i class="fa fa-bars"></i></a>
            <a href="/index.php" class="w3-bar-item w3-button w3-padding-large">HOME</a>
            <a href="#" class="w3-bar-item w3-button w3-padding-large"><strong>QUESTIONAIRRE</strong></a>
            <div class="w3-dropdown-hover w3-hide-small">
                <button class="w3-padding-large w3-button" title="More">MORE <i class="fa fa-caret-down"></i></button>
                <div class="w3-dropdown-content w3-bar-block w3-card-4">
                    <a href="/index.php/#info" class="w3-bar-item w3-button">INFO</a>
                    <a href="/contact.html" class="w3-bar-item w3-button">CONTACT</a>
                    <a href="/index.php/#donate" class="w3-bar-item w3-button">DONATE</a>
                </div>
            </div>
        </div>

contact.html 出现同样的问题,无法转到“CONTACT”或“DONATE” 我尝试了绝对链接,但没有帮助。

(可以看问题here,不过我还没有ssl证书)

如何修复引用?

【问题讨论】:

    标签: php html hyperlink navbar href


    【解决方案1】:

    我可以通过将所有页面(indexcontactquiz)改成.php 而不是一些.html 来解决这个问题。我猜他们之间的交叉引用存在一些问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-20
      • 1970-01-01
      • 2019-08-01
      • 1970-01-01
      • 2014-02-12
      相关资源
      最近更新 更多