0
<html>
<style>
\t #q1{
\t \t text-decoration: none;
\t \t color: black;
\t \t font-weight: bold;
\t \t float: none;
\t \t display: block;
\t }
\t \t #q2{
\t \t text-decoration: none;
\t \t color: black;
\t \t font-weight: bold;
\t \t float: none;
\t \t display: block;
\t }
\t \t #q3{
\t \t text-decoration: none;
\t \t color: black;
\t \t font-weight: bold;
\t \t float: none;
\t \t display: block;
\t }
\t \t #q4{
\t \t text-decoration: none;
\t \t color: black;
\t \t font-weight: bold;
\t \t float: none;
\t \t display: block;
\t }
\t .over{
\t \t background-color: red;
\t }
\t
\t </style>
\t <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
\t <script>
\t \t $(document).ready(function(){
\t \t \t $("#hide").click(function(){
\t \t \t \t $("p").hide();
\t \t \t });
\t \t \t $("#show").click(function(){
\t \t \t \t $("p").show();
\t \t \t });
\t \t \t
\t \t \t \t
\t \t });
\t \t
\t \t
\t </script>
\t <script>
\t \t function toggleDiv(divClass){
\t \t \t $("."+divClass).toggle();
\t \t }
\t </script>
\t <script>
\t \t $("#q1").mouseover(function(){
\t \t $(this).addClass("over");
\t \t });
\t </script>
\t <body>
<h2>FAQ Hide/Show Demo</h2>
\t \t <a id = "show" href="#">Show All</a> | <a id = "hide" href="#">Hide All</a>
<div class="faq"> \t \t
\t <a href="javascript:toggleDiv('answer1');" id = "q1" >1.How much does it cost? </a>
<div class = "answer1" >
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
<strong>aliquam</strong> erat volutpat. Ut wisi enim ad minim veniam, quis nostrud
exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea
commodo consequat. </p>
</div>
我想補充的是添加.over類CSS和鏈接的顏色都將其更改爲紅色,每當我的鼠標懸停在鏈接。任何意見或建議如何?
謝謝,這有助於很多。 – rich