LifeType 中文開發論壇

開發 => 外掛程式 => 主題作者是: kennyG 於 十一月 03, 2005, 09:18:07 上午



主題: 有關摺疊選單的問題
作者: kennyG十一月 03, 2005, 09:18:07 上午
http://60.248.69.186/kenny/index.php?blogId=1
小弟將原來的程式碼
<!--archives-->
<h2> {$locale->tr("archives")} </h2>
<ul>
{foreach from=$archives item=month}
<li><a href="{$month->getUrl()}">{$month->getName()}</a></li>
{/foreach}
</ul>

<!--categories-->
<h2> {$locale->tr("categories")} </h2>
<ul>
{foreach from=$articlecategories item=articleCategory}
<li><a href="{$url->categoryRssLink($articleCategory)}"><img src="{$url->getUrl("/imgs/rss_logo_small.gif")}" style="border:0px;" alt="RSS 0.90" align="middle" /></a>
<a href="{$url->categoryLink($articleCategory)}">{$articleCategory->getName()}</a> [{$articleCategory->getNumArticles()}]</li>
{/foreach}
</ul>

更換成以下程式碼
<!--categories-->
{literal}
<script language="javascript" type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
</script>
{/literal}
<ul>
{$locale->tr("categories")}
<div class="side">
<form name="Category" style="margin:2px;">
<select name="menu_menu" onChange="MM_jumpMenu('parent',this,0)">
<option value="" selected>請選擇分類</option>
{foreach from=$articlecategories item=articleCategory}
<option value="{$url->categoryLink($articleCategory)}">
{$articleCategory->getName()} [{$articleCategory->getNumArticles()}]
</option>
{/foreach}
</select>
</form>
</div>
</ul>


<!--archives-->
<ul>
{$locale->tr("archives")}

<div class="side">
<form name="Month" style="margin:2px;">
<select name="menu_menu" onChange="MM_jumpMenu('parent',this,0)">
<option value="" selected>前期文章</option>
{foreach from=$archives item=month}
<option value="{$month->getUrl()}">
{$month->getName()} [{$month->getNumArticles()}]
</option>
{/foreach}
</select>
</form>
</div>
</ul>

會出現一個問題
雖然功能可以正常使用
就是標題列沒辦法像原來一樣的格式
但是如果用手動的去改
<!--archives-->
<h2> {$locale->tr("archives")} </h2>
<ul>
<div class="side">
<form name="Month" style="margin:2px;">
<select name="menu_menu" onChange="MM_jumpMenu('parent',this,0)">
<option value="" selected>前期文章</option>
{foreach from=$archives item=month}
<option value="{$month->getUrl()}">
{$month->getName()} [{$month->getNumArticles()}]
</option>
{/foreach}
</select>
</form>
</div>
</ul>

<!--categories-->
<h2> {$locale->tr("categories")} </h2>
<ul>
{literal}
<script language="javascript" type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
</script>
{/literal}
<ul>
{$locale->tr("categories")}
<div class="side">
<form name="Category" style="margin:2px;">
<select name="menu_menu" onChange="MM_jumpMenu('parent',this,0)">
<option value="" selected>請選擇分類</option>
{foreach from=$articlecategories item=articleCategory}
<option value="{$url->categoryLink($articleCategory)}">
{$articleCategory->getName()} [{$articleCategory->getNumArticles()}]
</option>
{/foreach}
</select>
</form>
</div>
</ul>

改成以上的話
標題可以變成原來的樣子
但是選擇下拉選單的選項就沒有作用了
不知道此問題如何解決
請各位先知不吝賜教感謝您