<div class="codetitle"> <span><a style="CURSOR: pointer" data="69097" class="copybut" id="copybut69097" onclick="doCopy('code69097')"><u>複製代碼</u></a></span> 代碼如下:</div> <div class="codebody" id="code69097"> <br>//W3C/1. Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br> <br> <br><title></title> <br><style type="text/css"> <br><br></style> <br><script src="jquery%20-1.9.1.js" type="text/javascript"></script> <br><script type="text/javascript"> <BR>$(function () { <br><br>$(' #Button1').click(function () { <BR>//為所有具有id屬性的元素設定樣式,動畫效果<BR>//$('div[title]').hide(3000); <BR>//$('div[title=t1]').hide(3000); <BR>//$('div[title!=t1]').hide(3000); <BR>// //屬性值以t開頭<BR>//$('div[title^=t]').hide(3000 <BR>//$('div[title$=1]').hide(3000); <BR>//$('div[title*=t]').hide(3000); <BR>// //id值以d開始,title值以3結束<BR>$('div[id^ =d][title$=4]').hide(3000); <BR>}) <BR>}) <BR></script> <br> <br> <br> <div title="t1">第一層<br> </div> <br><div id="div2" title="t2">第二層<br> </div> <br><div id="div3" title="t3">第三層<br> </div> <br><div id="div4" title="t4">第四層<br> </div> <br> <br> <br> <br> </div>