2016-07-25 64 views
0

有了這個代碼,我想setVisibility 2 DIV,暫時只有1格=「注意 - 問題 - 子」,我想添加其他分區:點擊次數和能見度2 DIV

<label for="note2" title="Passable"> 
    <a role="button" class="btn btn-note btn-xs" onclick="setVisibility('Note-question-sub', 'block');"> 
     <i class="fa fa-plus rouge" aria-hidden="true"></i> 
     <span class="sr-only">Passable</span> 
    </a> 
    <input type="radio" value="2" name="note" id="note2" /> 
</label> 

這是我的JS代碼:

function setVisibility(id, visibility) { 
    document.getElementById(id).style.display = visibility; 
} 

非常感謝你提前

+1

因此,修改函數採取2個參數,或稱它兩次...? –

回答

1

您可以撥打setVisibility兩次

<label for="note2" title="Passable"> 
    <a role="button" class="btn btn-note btn-xs" onclick="setVisibility('Note-question-sub', 'block'); setVisibility('YOUR_SECOND_DIV', 'block'); "><!--YOUR_SECOND_DIV is your second div--> 
     <i class="fa fa-plus rouge" aria-hidden="true"></i> 
     <span class="sr-only">Passable</span> 
    </a> 
    <input type="radio" value="2" name="note" id="note2" /> 
</label> 
+0

非常感謝,它解決了我的問題:) – Pierre