使用 JavaScript 庫
改為
<script src=""></script>
這樣
<script src="https://w3schools.tw/lib/w3.js"></script>
如何 - 幻燈片
JavaScript 示例
<img class="nature" src="img_snowtops.jpg" width="100%">
<img class="nature" src="img_mountains.jpg" width="100%">
<img class="nature" src="img_nature.jpg" width="100%">
<script>
w3.slideshow(".nature", 1500);
</script>
自己動手試一試 »
隱藏/顯示 HTML 元素
JavaScript 示例
<p>
<button onclick="w3.hide('#London')">隱藏倫敦</button>
<button onclick="w3.show('#London')">顯示倫敦</button>
</p>
<div id="London" class="w3-container w3-red">
<h2>
倫敦</h2>
<p>倫敦是英格蘭的首都。</p>
</div>
<div id="Paris" class="w3-container w3-green">
<h2>巴黎</h2>
<p>巴黎是法國的首都。</p>
</div>
<div id="Tokyo" class="w3-container w3-blue">
<h2>東京</h2>
<p>東京是日本的首都。</p>
</div>
自己動手試一試 »
恭喜!
您已經學習了使用 JavaScript 庫的基礎知識。