您正在搜索 #m 元素的子元素 (ul),但没有这样的子元素
你可能想用 id把它隐藏<ul>
起来li
m
所以只要改变
<li id="m"><a href="#">Fine Photographs</a></li>
<ul class="hide">
<li><a href="catalog_photographs_19.php" style="margin-left:2cm; width: 2cm;" >19th century </a></li>
<li><a href="catalog_photographs_20.php" style="margin-left:2cm; width: 2cm;" >20th century </a></li>
</ul>
到
<li id="m"><a href="#">Fine Photographs</a>
<ul class="hide">
<li><a href="catalog_photographs_19.php" style="margin-left:2cm; width: 2cm;" >19th century </a></li>
<li><a href="catalog_photographs_20.php" style="margin-left:2cm; width: 2cm;" >20th century </a></li>
</ul>
</li>