- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在测试一些简单的 HTML/JavaScript 代码,但是,当我打开网站时,显示/隐藏脚本只隐藏了第一部分,但对其他部分没有任何作用。我想要它,以便对于单击的每个图像,都会显示与该图像对应的部分。
代码如下:
<!DOCTYPE html>
<html>
<head>
<title>Profile Bird</title>
<link rel="stylesheet" type="text/css" href="../CSS/styles.css">
<script>
function displayBird1() {
document.getElementById("intro").style.display = "none";
documemt.getElementById("king").style.display = "block";
document.getElementById("owl").style.display = "none";
document.getElementById("eagle").style.display = "none";
document.getElementById("starling").style.display = "none";
}
function displayBird2() {
document.getElementById("intro").style.display = "none";
documemt.getElementById("king").style.display = "none";
document.getElementById("owl").style.display = "block";
document.getElementById("eagle").style.display = "none";
document.getElementById("starling").style.display = "none";
}
function displayBird3() {
document.getElementById("intro").style.display = "none";
documemt.getElementById("king").style.display = "none";
document.getElementById("owl").style.display = "none";
document.getElementById("eagle").style.display = "block";
document.getElementById("starling").style.display = "none";
}
function displayBird4() {
document.getElementById("intro").style.display = "none";
documemt.getElementById("king").style.display = "none";
document.getElementById("owl").style.display = "none";
document.getElementById("eagle").style.display = "none";
document.getElementById("starling").style.display = "block";
}
</script>
</head>
<body>
<header>
<h1>Cool Twitching</h1>
<img class="imageBanner" src="../images/banner.jpg">
<p>Birdwatching is not a hobby it is a lifestyle</p>
</header>
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="news.html">News</a></li>
<li><a href="profile.html">In Profile</a></li>
<li><a href="excursions.html">Excursions</a></li>
<li><a href="applications.html">Applications</a></li>
</ul>
</nav>
<main>
<div>
<img class="smallImage" src="../images/bird1.jpg" onclick="displayBird1()" onmouseover="test()">
<img class="smallImage" src="../images/bird2.jpg" onclick="displayBird2()">
<img class="smallImage" src="../images/bird3.jpg" onclick="displayBird3()">
<img class="smallImage" src="../images/bird4.jpg" onclick="displayBird4()">
</div>
<section id="intro" style="display:block" >
<p style="font-size: 16px"> Please click an image to choose what bird information to display </p>
</section>
<section id="king" style="display:none;">
<p>To see previous profile birds click the images on the left.</p><br><br>
<h2>Kingfisher</h2>
<img class="smallImageRight" src="../images/bird1.jpg">
<p>Kingfishers or Alcedinidae are a family of small to medium-sized, brightly colored birds in the order Coraciiformes. They have a cosmopolitan distribution, with most species found outside the Americas. The family contains 114 species and is divided into three subfamilies and 19 genera. All kingfishers have large heads, long, sharp, pointed bills, short legs, and stubby tails. Most species have bright plumage with only small differences between the sexes.
<br><br> Most species are tropical in distribution, and a slight majority are found only in forests. They consume a wide range of prey usually caught by swooping down from a perch. While kingfishers are usually thought to live near rivers and eat fish, many species live away from water and eat small invertebrates. Like other members of their order, they nest in cavities, usually tunnels dug into the natural or artificial banks in the ground. Some kingfishers nest in arboreal termite nests. A few species, principally insular forms, are threatened with extinction. In Britain, the word "kingfisher" normally refers to the common kingfisher.</p>
</section>
<section style="display:none;" id="owl">
<p>To see previous profile birds click the images on the left.</p><br><br>
<h2>Barn Owl</h2>
<img class="smallImageRight" src="../images/bird2.jpg">
<p>The barn owl (Tyto alba) is the most widely distributed species of owl and one of the most widespread of all birds. It is also referred to as the common barn owl, to distinguish it from other species in its family, Tytonidae, which forms one of the two main lineages of living owls, the other being the typical owls (Strigidae). The barn owl is found almost everywhere in the world except polar and desert regions, Asia north of the Himalayas, most of Indonesia, and some Pacific islands.
<br><br>
Phylogenetic evidence shows that there are at least three major lineages of barn owl, one in Europe, western Asia and Africa, one in southeast Asia and Australasia, and one in the Americas, and some highly divergent taxa on islands. Accordingly, some authorities split the group into the western barn owl for the group in Europe, western Asia and Africa, the American barn owl for the group in the Americas, and the eastern barn owl for the group in southeast Asia and Australasia. There is a considerable variation between the sizes and colour of the approximately 28 subspecies but most are between 33 and 39 cm in length with wingspans ranging from 80 to 95 cm. The plumage on head and back is a mottled shade of grey or brown, the underparts vary from white to brown and are sometimes speckled with dark markings. The face is characteristically heart-shaped and is white in most subspecies. This owl does not hoot, but utters an eerie, drawn-out shriek.
</p>
</section>
<section style="display:none;" id="eagle">
<p>To see previous profile birds click the images on the left.</p><br><br>
<h2>Golden Eagle</h2>
<img class="smallImageRight" src="../images/bird3.jpg">
<p>The golden eagle (Aquila chrysaetos) is one of the best-known birds of prey in the Northern Hemisphere. It is the most widely distributed species of eagle. Like all eagles, it belongs to the family Accipitridae. These birds are dark brown, with lighter golden-brown plumage on their napes. Immature eagles of this species typically have white on the tail and often have white markings on the wings. Golden eagles use their agility and speed combined with powerful feet and massive, sharp talons to snatch up a variety of prey, mainly hares, rabbits, marmots and other ground squirrel.
<br><br>
Golden eagles maintain home ranges or territories that may be as large as 77 sq miles. They build large nests in cliffs and other high places to which they may return for several breeding years. Most breeding activities take place in the spring; they are monogamous and may remain together for several years or possibly for life. Females lay up to four eggs, and then incubate them for six weeks. Typically, one or two young survive to fledge in about three months. These juvenile golden eagles usually attain full independence in the fall, after which they wander widely until establishing a territory for themselves in four to five years.
<br><br>
</p>
</section>
<section style="display:none;" id="starling">
<p>To see previous profile birds click the images on the left.</p><br><br>
<h2>Starling</h2>
<img class="smallImageRight" src="../images/bird3.jpg">
<p>Starlings are small to medium-sized passerine birds in the family Sturnidae. The name "Sturnidae" comes from the Latin word for starling, sturnus. Many Asian species, particularly the larger ones, are called mynas, and many African species are known as glossy starlings because of their iridescent plumage. Starlings are native to Europe, Asia and Africa, as well as northern Australia and the islands of the tropical Pacific. Several European and Asian species have been introduced to these areas as well as North America, Hawaii and New Zealand, where they generally compete for habitats with native birds and are considered to be invasive species. The starling species familiar to most people in Europe and North America is the common starling, and throughout much of Asia and the Pacific, the common myna is indeed common.
<br><br>
Starlings have strong feet, their flight is strong and direct, and they are very gregarious. Their preferred habitat is fairly open country, and they eat insects and fruit. Several species live around human habitation and are effectively omnivores. Many species search for prey such as grubs by "open-bill probing", that is, forcefully opening the bill after inserting it into a crevice, thus expanding the hole and exposing the prey; this behaviour is referred to by the German verb zirkeln.
</p>
</section>
</main>
<footer>
<p>All images copyrighted by Cool Twitchers</p>
</footer>
</body>
</html>
感谢任何帮助。
最佳答案
<!DOCTYPE html>
<html>
<head>
<title>Profile Bird</title>
<link rel="stylesheet" type="text/css" href="../CSS/styles.css">
<script>
function displayBird1() {
document.getElementById("intro").style.display = "none";
document.getElementById("king").style.display = "block";
document.getElementById("owl").style.display = "none";
document.getElementById("eagle").style.display = "none";
document.getElementById("starling").style.display = "none";
}
function displayBird2() {
document.getElementById("intro").style.display = "none";
document.getElementById("king").style.display = "none";
document.getElementById("owl").style.display = "block";
document.getElementById("eagle").style.display = "none";
document.getElementById("starling").style.display = "none";
}
function displayBird3() {
document.getElementById("intro").style.display = "none";
document.getElementById("king").style.display = "none";
document.getElementById("owl").style.display = "none";
document.getElementById("eagle").style.display = "block";
document.getElementById("starling").style.display = "none";
}
function displayBird4() {
document.getElementById("intro").style.display = "none";
document.getElementById("king").style.display = "none";
document.getElementById("owl").style.display = "none";
document.getElementById("eagle").style.display = "none";
document.getElementById("starling").style.display = "block";
}
function test() {
}
</script>
</head>
<body>
<header>
<h1>Cool Twitching</h1>
<img class="imageBanner" src="../images/banner.jpg">
<p>Birdwatching is not a hobby it is a lifestyle</p>
</header>
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="news.html">News</a></li>
<li><a href="profile.html">In Profile</a></li>
<li><a href="excursions.html">Excursions</a></li>
<li><a href="applications.html">Applications</a></li>
</ul>
</nav>
<main>
<div>
<img class="smallImage" src="../images/bird1.jpg" onclick="displayBird1()" onmouseover="test()">
<img class="smallImage" src="../images/bird2.jpg" onclick="displayBird2()">
<img class="smallImage" src="../images/bird3.jpg" onclick="displayBird3()">
<img class="smallImage" src="../images/bird4.jpg" onclick="displayBird4()">
</div>
<section id="intro" style="display:block" >
<p style="font-size: 16px"> Please click an image to choose what bird information to display </p>
</section>
<section id="king" style="display:none;">
<p>To see previous profile birds click the images on the left.</p><br><br>
<h2>Kingfisher</h2>
<img class="smallImageRight" src="../images/bird1.jpg">
<p>Kingfishers or Alcedinidae are a family of small to medium-sized, brightly colored birds in the order Coraciiformes. They have a cosmopolitan distribution, with most species found outside the Americas. The family contains 114 species and is divided into three subfamilies and 19 genera. All kingfishers have large heads, long, sharp, pointed bills, short legs, and stubby tails. Most species have bright plumage with only small differences between the sexes.
<br><br> Most species are tropical in distribution, and a slight majority are found only in forests. They consume a wide range of prey usually caught by swooping down from a perch. While kingfishers are usually thought to live near rivers and eat fish, many species live away from water and eat small invertebrates. Like other members of their order, they nest in cavities, usually tunnels dug into the natural or artificial banks in the ground. Some kingfishers nest in arboreal termite nests. A few species, principally insular forms, are threatened with extinction. In Britain, the word "kingfisher" normally refers to the common kingfisher.</p>
</section>
<section style="display:none;" id="owl">
<p>To see previous profile birds click the images on the left.</p><br><br>
<h2>Barn Owl</h2>
<img class="smallImageRight" src="../images/bird2.jpg">
<p>The barn owl (Tyto alba) is the most widely distributed species of owl and one of the most widespread of all birds. It is also referred to as the common barn owl, to distinguish it from other species in its family, Tytonidae, which forms one of the two main lineages of living owls, the other being the typical owls (Strigidae). The barn owl is found almost everywhere in the world except polar and desert regions, Asia north of the Himalayas, most of Indonesia, and some Pacific islands.
<br><br>
Phylogenetic evidence shows that there are at least three major lineages of barn owl, one in Europe, western Asia and Africa, one in southeast Asia and Australasia, and one in the Americas, and some highly divergent taxa on islands. Accordingly, some authorities split the group into the western barn owl for the group in Europe, western Asia and Africa, the American barn owl for the group in the Americas, and the eastern barn owl for the group in southeast Asia and Australasia. There is a considerable variation between the sizes and colour of the approximately 28 subspecies but most are between 33 and 39 cm in length with wingspans ranging from 80 to 95 cm. The plumage on head and back is a mottled shade of grey or brown, the underparts vary from white to brown and are sometimes speckled with dark markings. The face is characteristically heart-shaped and is white in most subspecies. This owl does not hoot, but utters an eerie, drawn-out shriek.
</p>
</section>
<section style="display:none;" id="eagle">
<p>To see previous profile birds click the images on the left.</p><br><br>
<h2>Golden Eagle</h2>
<img class="smallImageRight" src="../images/bird3.jpg">
<p>The golden eagle (Aquila chrysaetos) is one of the best-known birds of prey in the Northern Hemisphere. It is the most widely distributed species of eagle. Like all eagles, it belongs to the family Accipitridae. These birds are dark brown, with lighter golden-brown plumage on their napes. Immature eagles of this species typically have white on the tail and often have white markings on the wings. Golden eagles use their agility and speed combined with powerful feet and massive, sharp talons to snatch up a variety of prey, mainly hares, rabbits, marmots and other ground squirrel.
<br><br>
Golden eagles maintain home ranges or territories that may be as large as 77 sq miles. They build large nests in cliffs and other high places to which they may return for several breeding years. Most breeding activities take place in the spring; they are monogamous and may remain together for several years or possibly for life. Females lay up to four eggs, and then incubate them for six weeks. Typically, one or two young survive to fledge in about three months. These juvenile golden eagles usually attain full independence in the fall, after which they wander widely until establishing a territory for themselves in four to five years.
<br><br>
</p>
</section>
<section style="display:none;" id="starling">
<p>To see previous profile birds click the images on the left.</p><br><br>
<h2>Starling</h2>
<img class="smallImageRight" src="../images/bird3.jpg">
<p>Starlings are small to medium-sized passerine birds in the family Sturnidae. The name "Sturnidae" comes from the Latin word for starling, sturnus. Many Asian species, particularly the larger ones, are called mynas, and many African species are known as glossy starlings because of their iridescent plumage. Starlings are native to Europe, Asia and Africa, as well as northern Australia and the islands of the tropical Pacific. Several European and Asian species have been introduced to these areas as well as North America, Hawaii and New Zealand, where they generally compete for habitats with native birds and are considered to be invasive species. The starling species familiar to most people in Europe and North America is the common starling, and throughout much of Asia and the Pacific, the common myna is indeed common.
<br><br>
Starlings have strong feet, their flight is strong and direct, and they are very gregarious. Their preferred habitat is fairly open country, and they eat insects and fruit. Several species live around human habitation and are effectively omnivores. Many species search for prey such as grubs by "open-bill probing", that is, forcefully opening the bill after inserting it into a crevice, thus expanding the hole and exposing the prey; this behaviour is referred to by the German verb zirkeln.
</p>
</section>
</main>
<footer>
<p>All images copyrighted by Cool Twitchers</p>
</footer>
</body>
</html>
documemt
改成 document
test
或将其从鼠标悬停事件中移除关于javascript - 使用 javascript 显示/隐藏 <section> 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59218227/
这个问题在这里已经有了答案: Multi level categories with items on all levels in UITableView (1 个回答) 关闭 6 年前。 标题说明
我想在编译时从代码中删除未使用的函数。然后我写一些代码(main.c): #include const char *get1(); int main() { puts( get1() );
升级到 Xcode 4.4 后,当我尝试在 iPhone 或 iPad 上运行我的(通用)应用程序时,我遇到了这个烦人的链接器错误。如果我在 iOS 模拟器上运行它,我没有问题... 我尝试添加 ar
我以前从未见过这个错误,我搜索了它可能发生的原因,但找不到任何相关信息: CoreData: error: Serious application error. An exception was ca
我正在使用以下内容填充 UITableView 部分的各个部分: fetchedResultsController = NSFetchedResultsController(fetchReques
是标签允许包含在另一个 中标签?它会在 HTML5 中验证吗? 最佳答案 Yes ! w3 鼓励您在分节内容的元素中显式包装节,而不是依赖于在分节内容的一个元素中包含多个标题而生成的隐式节,并且允许
我使用部分来确定页面的不同部分。这些部分的底部边距为 90px,但是当在页面中创建/放置 ID 为“clients-full”的部分时,我希望出现在它之前/上方的任何部分的底部边距为 0。我可以做吗这
我现在有一个第三方提供的c静态库(用arm-gcc编译的)。我不可能(让第三方)重新编译库。 在调查库内容时,我发现 gcc 选项 -ffunction-sections 和 -fdata-secti
大家好,我陷入了一个奇怪的问题,我正在重新加载 tableViewSection,它正在正确地重新加载该部分,但它隐藏了其他部分,直到我向上或向下滚动它。我使用以下代码重新加载 func tabl
在我的项目中,我有扩展 ArrayAdapter 的类并实现 SectionIndexer .实现方法时getPositionForSection和 getSectionForPosition我发现了
我正在尝试编译 scss,以便在它具有 class1 时获得该部分。我不知道如何去做,因为我得到了空间,而且它的工作方式不一样。 当前输出: .class2 > section .class1 {
我正在阅读 Mark Pilgirm 的“Dive into HTML5”和 semantics section ,它讨论了 HTML5 如何引入 和 元素。它说 s 代表通用文档或部分,而 s
我是使用ARM编译器进行Keil Microvision V5.12编程的新手。 我无法编译一个简单的组装项目,但出现此错误: .\Objects\learn.sct(7): error: L6236
这是我第一次在这里问问题,但我不得不说这个网站在过去几个月里给了我巨大的帮助(iphone-dev-wise),我为此表示感谢。 但是,我没有找到解决这个问题的方法:我有一个包含 2 个部分的 UIT
我在 IOS 中实现了一个 TableView (4 个部分)。问题是我刚刚在第一部分添加了一个部分标题。其他部分没有标题。第一部分没有行(行数为 0)。其他部分有多行。当我滚动时,第一部分的标题不粘
我有一个包含多个部分的表格 View 。我希望能够将行从一个部分移动到另一个部分,并在没有行时删除一个部分。我正在尝试通过 moveRowAtIndexPath 执行此操作,但我的代码不起作用并抛出
我正在尝试删除不符合 for 循环条件的行。但是,我收到错误消息:“尝试从第 1 部分删除第 0 行,但更新前只有 1 个部分。”我以前从未见过这个,也不确定为什么会收到它。 我的代码: func
GCC 页面中针对功能部分和数据部分选项的以下内容: -ffunction-sections -fdata-sections Place each function or data item into
我想在安装新数据库之前删除旧数据库,以便为用户更新它。 我有以下情况: 在我的 Components 部分中,我为用户提供了一个选项: [Components] Name: "updateDataba
我从工作区添加了一个测试用例。可能已经一周了,所以我不记得它是来自 Backlog 还是来自董事会。 现在,当我进入测试/测试计划时,它没有出现。我找不到将其添加到测试套件的方法。 我可以通过测试区域
我是一名优秀的程序员,十分优秀!