1.slide.html内容如下
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>slide</title> <link rel="stylesheet" href="slide.css"> </head> <body> <div id="pn"> <p>商品筛选</p> <p>网络:移动4G,联通3G,电信3G</p> <div id="hpn" style="display:none"> <p>价格:5000</p> <p> 特点.... </p> </div> </div> <p class="slide"><a href="javascript:showDiv()" id="strHref" class="btn-slide">更多选项+</a></p> <script src="slide.js"></script> </body> </html>
2.slide.js内容如下
function showDiv(){ document.getElementById("hpn").style.display = "block"; document.getElementById("strHref").innerHTML = "收起-"; document.getElementById("strHref").href = "javascript:hideDiv()"; } function hideDiv(){ document.getElementById("hpn").style.display = "none"; document.getElementById("strHref").innerHTML = "更多选项+"; document.getElementById("strHref").href = "javascript:showDiv()"; }
3.slide.css内容如下
}
本文转自 素颜猪 51CTO博客,原文链接:
http://blog.51cto.com/suyanzhu/1901757