我创建了一个带标题的页面。此header.php具有以下格式:
<?php
$index_admin = "/test/index_test.php";
...
?>
<div id="button">
<ul>
<li><a href=<?=$index_test?>><span class="<?php if($currentpath == basename($index_test)){echo("buttonon");} ?>">test</span></a></li>
...
</ul>
</div>
,其中
$currentpath = basename(__FILE__)
在
之前的每一页中设置include "header.php"
因此,当我打开index_test页面时,我有类按钮,它会改变链接的颜色(因此它被置换为活动状态)。
现在我想创建一个隐藏的li子菜单,如下所示:
<li><a href=<?=$index_test?>><span class="<?php if($currentpath == basename($index_test)) {echo("buttonon");} ?>">test</span></a></li>
<ul style="display:none">
<li>...</li>
只有当我只去了
时才会被取代<li>
与
<onmouseover:"callfunctiontoshowthesubmenu">.
我在那里。
我的问题是:当我打开子菜单上列出的页面时,我想保持显示子菜单。我怎么能这样做?
哪种方法最快?