如何在php中创建活动导航栏?
您好,我正在尝试使我的导航栏在php中处于活动状态,这样用户就可以知道他们在哪个页面上。我是php新手,对它了解不多。那么,我如何在代码中添加class=“active”来创建一个活动导航栏并在同一index.php页面中显示所有页面呢如何在php中创建活动导航栏?,php,navigation,Php,Navigation,您好,我正在尝试使我的导航栏在php中处于活动状态,这样用户就可以知道他们在哪个页面上。我是php新手,对它了解不多。那么,我如何在代码中添加class=“active”来创建一个活动导航栏并在同一index.php页面中显示所有页面呢 <a href="?page=home"> Home</a></br> <a href="?page=news"> News</a></br> <a href="?page=abou
<a href="?page=home"> Home</a></br>
<a href="?page=news"> News</a></br>
<a href="?page=about"> About</a></br>
<a href="?page=contact"> Contact</a></br>
<?php
if (!isset($_GET['page'])) {
include "home.php";
} else {
switch ($_GET['page']) {
case "home":
include "home.php";
break;
case "news":
include "news.php";
break;
case "about":
include "about.php";
break;
case "contact":
include "contact.php";
break;
default:
include "home.php";
};
}
?>
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
创建菜单项数组,然后使用foreach
循环动态生成菜单
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
这样,当您向阵列添加新项目时,它们将显示在菜单中:
<html>
<head>
<title>Website</title>
<style type="text/css" media="screen">
.active {
font-weight: bold;
}
</style>
</head>
<body>
<?php
// This is your menu
$items = array("home", "news", "about", "contact");
foreach ($items as $item)
{
if (isset($_GET['page']) && $_GET['page'] == $item)
{
echo '<a href="?page=' . $item . '" class="active"> ' . $item . '</a></br>';
$activePage = $item . ".php";
}
else
{
echo '<a href="?page=' . $item . '"> ' . $item . '</a></br>';
}
}
// Include your page
if (isset($activePage))
{
include $activePage;
}
else
{
include "home.php";
}
?>
</body>
</html>
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
网站
.主动{
字体大小:粗体;
}
你应该用这段代码替换你的所有代码,并给它一个旋转。使用循环来减少您需要编写的冗余标记的数量,不仅可以节省您将来的大量时间 创建菜单项数组,然后使用
foreach
循环动态生成菜单
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
这样,当您向阵列添加新项目时,它们将显示在菜单中:
<html>
<head>
<title>Website</title>
<style type="text/css" media="screen">
.active {
font-weight: bold;
}
</style>
</head>
<body>
<?php
// This is your menu
$items = array("home", "news", "about", "contact");
foreach ($items as $item)
{
if (isset($_GET['page']) && $_GET['page'] == $item)
{
echo '<a href="?page=' . $item . '" class="active"> ' . $item . '</a></br>';
$activePage = $item . ".php";
}
else
{
echo '<a href="?page=' . $item . '"> ' . $item . '</a></br>';
}
}
// Include your page
if (isset($activePage))
{
include $activePage;
}
else
{
include "home.php";
}
?>
</body>
</html>
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
网站
.主动{
字体大小:粗体;
}
你应该用这段代码替换你的所有代码,并给它一个旋转。使用循环来减少您需要编写的冗余标记的数量,不仅可以节省您将来的大量时间 您可以使用下面的PHP代码作为导航。我建议您使用无序列表(即
)标记进行导航:
<ul>
<li<?php if($_GET['page']=="home") { echo " class=\"active\""; } ?>><a href="?page=home"> Home</a></li>
<li<?php if($_GET['page']=="news") { echo " class=\"active\""; } ?>><a href="?page=news"> News</a></li>
<li<?php if($_GET['page']=="about") { echo " class=\"active\""; } ?>><a href="?page=about"> About</a></li>
<li<?php if($_GET['page']=="contact"){ echo " class=\"active\""; } ?>><a href="?page=contact"> Contact</a></li>
</ul>
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
您可以使用下面的PHP代码作为导航。我建议您使用无序列表(即
)标记进行导航:
<ul>
<li<?php if($_GET['page']=="home") { echo " class=\"active\""; } ?>><a href="?page=home"> Home</a></li>
<li<?php if($_GET['page']=="news") { echo " class=\"active\""; } ?>><a href="?page=news"> News</a></li>
<li<?php if($_GET['page']=="about") { echo " class=\"active\""; } ?>><a href="?page=about"> About</a></li>
<li<?php if($_GET['page']=="contact"){ echo " class=\"active\""; } ?>><a href="?page=contact"> Contact</a></li>
</ul>
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
请尝试以下代码:
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦1
伦敦是英国的首都。它是英国人口最多的城市,
拥有超过1300万居民的大都市区。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦位于泰晤士河上,两千年来一直是一个重要的定居点,
它的历史可以追溯到由罗马人建立,罗马人将其命名为Londinium。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦2
伦敦是英国的首都。它是英国人口最多的城市,
拥有超过1300万居民的大都市区。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦位于泰晤士河上,两千年来一直是一个重要的定居点,
它的历史可以追溯到由罗马人建立,罗马人将其命名为Londinium。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦3
伦敦是英国的首都。它是英国人口最多的城市,
拥有超过1300万居民的大都市区。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦位于泰晤士河上,两千年来一直是一个重要的定居点,
它的历史可以追溯到由罗马人建立,罗马人将其命名为Londinium。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
$(文档).ready(函数(){
$(“#1”)。单击(函数(){
$(“第1节”).show();
$(“#第2节”).hide();
$(“#第3节”).hide();
});
$(“#2”)。单击(函数(){
$(“#第1节”).hide();
$(“第2节”).show();
$(“#第3节”).hide();
});
$(“#3”)。单击(函数(){
$(“#第1节”).hide();
$(“#第2节”).hide();
$(“第3节”).show();
});
})
尝试以下代码:
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦1
伦敦是英国的首都。它是英国人口最多的城市,
拥有超过1300万居民的大都市区。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦位于泰晤士河上,两千年来一直是一个重要的定居点,
它的历史可以追溯到由罗马人建立,罗马人将其命名为Londinium。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦2
伦敦是英国的首都。它是英国人口最多的城市,
拥有超过1300万居民的大都市区。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦位于泰晤士河上,两千年来一直是一个重要的定居点,
它的历史可以追溯到由罗马人建立,罗马人将其命名为Londinium。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦3
伦敦是英国的首都。它是英国人口最多的城市,
拥有超过1300万居民的大都市区。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
伦敦位于泰晤士河上,两千年来一直是一个重要的定居点,
它的历史可以追溯到由罗马人建立,罗马人将其命名为Londinium。
<section id="section1">
<h2>London1</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section2" style="display:none">
<h2>London2</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<section id="section3" style="display:none">
<h2>London3</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing on the River Thames, London has been a major settlement for two millennia,
its history going back to its founding by the Romans, who named it Londinium.
</p>
</section>
<?php include 'footer.php'; ?>
<script type="text/javascript">
$(document).ready(function(){
$("#1").click(function(){
$("#section1").show();
$("#section2").hide();
$("#section3").hide();
});
$("#2").click(function(){
$("#section1").hide();
$("#section2").show();
$("#section3").hide();
});
$("#3").click(function(){
$("#section1").hide();
$("#section2").hide();
$("#section3").show();
});
})
</script>
$(文档).ready(函数(){
$(“#1”)。单击(函数(){
$(“第1节”).show();
$(“#第2节”).hide();
$(“#第3节”).hide();
});
$(“#2”)。单击(函数(){
$(“#第1节”).hide();
$(“第2节”).show();
$(“#第3节”).hide();
});
$(“#3”)。单击(函数(){
$(“#第1节”).hide();
$(“#第2节”).hide();
$(“第3节”).show();
});
})
伦敦1
2
3
伦敦1
2
3
.样式激活{
文字装饰:红色下划线上划线波浪形;
}
.样式激活{
文字装饰:红色下划线上划线波浪形;
}
主页(第1/5页)
我家维修公司。
山谷地区没有家庭修理工作太大了