<div id="dept-or-user-div" class="panel" style="padding-bottom:10px;">
<h3 class="div-title">Select Alert Recipients</h3>
<div class="recipient-error" style="display:none;"><p style="padding-top:10px; color:#f00;">Please select at least one recipient</p></div>
<p>
<input type="radio" checked value="dept" name="user-or-dept">Department</input>
<input type="radio" value="user" name="user-or-dept">User</input>
<input type="radio" value="both" name="user-or-dept">Both</input>
</p>
<div class="department-select" class="dept">
<p><label for="department-choice">Department:</label>
<select name="department-choice" id="department-choice">
<option></option>
<?php
echo get_departments();
?>
</select></p>
</div><!--end #department-select-->
<div class="user-select user" >
<p><label for="user-choice">User:</label>
<select name='user-choice' id="user-choice">
<option></option>
<?php
echo get_users('option');
?>
</select></p>
</div><!--end #user-select-->
</div><!--end #dept-or-user-div-->
在這裏,我有三個單選按鈕如何在特定單選按鈕被選中時調用JavaScript?
- 系(部下拉)
- 用戶(用戶下拉)
- 雙方(用戶和部門dropwon)
而且我想要什麼當單選按鈕的值爲「Both」,即第三個單選按鈕被選中時,我想調用一個js函數並根據部門值動態填充用戶下拉列表。我怎樣才能做到這一點?
只需使用一個事件來調用一個js函數,該函數將檢查是否被選中,然後調用您想運行的任何函數 – Anigel
以及如何填充用戶下拉列表? – S52