【问题标题】:Buttons on html page won't open up to separate pagehtml页面上的按钮不会打开到单独的页面
【发布时间】:2019-09-22 12:06:12
【问题描述】:

我无法使用主页底部的按钮链接到包含各种信息的其他页面,例如我在访问中创建的表格。这是关于信息技术的大学入门课程的最后一个项目,我从未制作过网站。

尝试了很多不同的方法,但它似乎只适用于已下载所有文件的计算机,而不是来自非本地服务器。

您应该能够单击底部的按钮,它将打开一个包含其他信息的单独页面。我试图上传到代码中的所有其他文件都已保存为 .html

<html><head>
</head><body bgcolor="#808080" <link="" rel="stylesheet" type="text/css" href="style.css">


<h1>
    Serial Killers
</h1>
<h3>LIS 351 Final Project by Luke Tinsey</h3>
<img src="https://i.pinimg.com/originals/59/56/be/5956bef9b1d3384714d5e37826e41055.png" alt="Serial Killer Collage" width="400" height="300">
<p style="font-size: 25px;">
    My project is about serial killers and I'm interested in creating a database that includes details about some of the most infamous killers in the world.
    I list things such as their names, methods of killing, hometowns, confirmed and potential kills.
</p><p>
</p><p style="font-size: 25px;"></p>
    The serial killers I focused on are:
    <ul>
    <li>1. Ted Bundy</li>
    <li>2. Jeffrey Dahmer</li>
    <li>3. Harold Shipman</li>
    <li>4. Belle Gunness</li>
    <li>5. John Wayne Gacy</li>
    <li>6. Edmund Kemper</li>
    <li>7. Gary Ridgway</li>
</ul>
<p></p>
<p></p>
<p>Click the links below for some more information!</p>
<button onclick="window.location.href='SerialKillersInfo%20Query.html'">Serial Killer Information</button>
<button onclick="window.location.href='Method%20Query.html'">Methods</button>
<button onclick="window.location.href='Documentation%20Query.html'">Documentation</button>
<button onclick="window.location.href='Method_Killer%20Query.html'">Cold Weather Correlation</button>
<p></p>
<p></p>
<button onclick="window.location.href='citations.html'">Citations</button>
<button onclick="window.location.href='Reflection%20Response.htm'">Reflection Response</button>
</body></html>

【问题讨论】:

  • 你能分享一些代码吗?
  • 抱歉,刚刚做了
  • 这是来自access和word和另一个html页面的文件。我了解如何使用 url 做按钮,但是当我打开 html 页面并将这些 url 复制到我的代码中时,它不会显示出来。

标签: html css web button


【解决方案1】:

将链接添加到按钮的正确方法实际上是使用 a 标签。

然后,您可以使用一点 css 使您的标签看起来像一个按钮 这是一个示例,您可以简单地将 href 中的内容替换为您的 html 文件

<a href="file.html">Click Here!</a>

【讨论】:

    【解决方案2】:

    如果您的其他 .html 文件与该文件位于同一文件夹/目录中,则将您的链接更改为该文件。

    <button onclick="window.location.href='./SerialKillersInfo%20Query.html'">Serial Killer Information</button>
    

    我也强烈建议您删除文档名称中的空格并插入 SerialKillersInfoQuery.html

    <button onclick="window.location.href='./SerialKillersInfoQuery.html'">Serial Killer Information</button>
    

    简而言之,只需在 html 文件的名称前添加 ./infront。

    【讨论】:

      猜你喜欢
      • 2019-12-16
      • 2011-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-05
      • 2020-09-18
      相关资源
      最近更新 更多