<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>编程狮(w3cschool.cn)</title>
<style>
.class1 {
background-color: orange;
color: white;
font-size: 30px;
padding: 16px;
}
.class2 {
background-color: green;
color: white;
font-size: 20px;
padding: 16px;
}
</style>
<script src="https://7npmedia.w3cschool.cn/w3.js"></script>
<body class="w3-container">
<h2>测试 HTML 中的 W3.JS</h2>
<p>点击按钮让 id="London" 在 class="class1" 和 class="class2"之间切换</p>
<p><button onclick="w3.toggleClass('#London','class1','class2')">切换类</button></p>
<div id="London" class="city">
<h2>伦敦</h2>
<p>伦敦是英国的首都.</p>
</div>
<div id="Paris" class="city">
<h2>巴黎</h2>
<p>巴黎是法国的首都.</p>
</div>