我正在尝试使用 disease.sh API 制作一个冠状病毒病例跟踪器,但 JavaScript 无法从输入字段中获取国家/地区,除非刷新页面。我尝试删除事件侦听器并添加一个 onclick 属性,但那没有不工作,所以我猜这与未正确制作端点有关。
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="style.css" type="text/css">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-expand-md bg-dark navbar-dark">
<!-- Brand -->
<a class="navbar-brand" href="#">
<img src="./images/logo.png" class="img-fluid" alt="logo">
</a>
<p class="display-none">Corona Virus Case Tracker</p>
<!-- Toggler/collapsibe Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Navbar links -->
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav ml-auto">
<li class="nav-item" onmouseover="changeThing()" onmouseout="changeThingBack()">
<a class="nav-link active" id="list-item1" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">More information</a>
</li>
</ul>
</div>
</nav>
慕标5832272
呼啦一阵风
相关分类