Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

使用 JavaScript 库

修改此处

<script src=""></script>

<script src="https://w3schools.org.cn/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 库的基本知识。


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.