質問する
126 次
1 に答える
0
webroot/jsにファイルを作成します。例としてmenu_match.jsを使用します。内部のコードは次のようにフォーマットする必要があります(関数に名前を付ける必要があることを除いて、基本的に同じですが、後で呼び出すことになります)。
function menu_match()
{
if(this.value.match('Convegni')) {
document.getElementById('menu3').style.display = 'block'; }
else { document.getElementById('menu3').style.display = 'none';
}
次に、ビューにこのjsファイルへのリンクを含める必要があります。
<?php echo($javascript->link("des_toggle_gen_drug.js")); ?>
次に、実際のコードではなく関数を参照するように選択を変更する必要があります。
<select onchange="return menu_match()" ..... </select>
于 2013-02-18T14:50:52.803 に答える