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


To add a JavaScript Library, we have to add a link.

We change this:

<script src=""></script>

To this:

<script src="https://www.w3schools.com/lib/w3.js"></script>

How to - Slideshow

JavaScript Example

<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>
Try it Yourself »

Hide/Show HTML Elements

JavaScript Example

<p>
<button onclick="w3.hide('#London')">Hide London</button>
<button onclick="w3.show('#London')">Show London</button>
</p>

<div id="London" class="w3-container w3-red">
  <h2>London</h2>
  <p>London is the capital city of England.</p>
</div>

<div id="Paris" class="w3-container w3-green">
  <h2>Paris</h2>
  <p>Paris is the capital of France.</p>
</div>

<div id="Tokyo" class="w3-container w3-blue">
  <h2>Tokyo</h2>
  <p>Tokyo is the capital of Japan.</p>
</div>
Try it Yourself »

Congratulations!

You have just learned the basics of using a JavaScript library.


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

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.