请在下面找到我用来输入用户从下拉列表中选择的多个选项的代码。问题是我需要做同样的事情,但使用jCombo下拉。此外,我需要计算驱动的组合名称,如sel1,sel2,sel3等。
请看一下代码,让我知道可以做些什么:(
<script type="text/javascript">
$(document).ready(function() {
$("#visitp").jCombo("getEmployees.php", { parent: "", selected_value : "<?php echo $employee_id;?>" } );
$("#nparticipants").change(function(){
// The easiest way is of course to delete all selectpar before adding new ones
//$("#holder").html("");
var count = $("#selectpar select").size();
var requested = parseInt($("#nparticipants").val(),10);
if (requested > count) {
for(i=count; i<requested; i++) {
var $ctrl = $('<select/>').attr({ type: 'text', name:'text', value:'text'});
//var $ctrl = $("#visitp").jCombo("getEmployees.php", { parent: "", selected_value : "<?php echo $employee_id;?>" } );
alert($ctrl);
$("#selectpar").append($ctrl);
}
}
else if (requested < count) {
var x = requested - 1;
$("#selectpar select:gt(" + x + ")").remove();
}
});
});
</script>
<form id="" action="" method="post">
<select id="nparticipants" name="nparticipants">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<div id="selectpar"></div>
<select id="visitp" name="visitp"></select>
<input type="submit" value="Go" />
</form>
伙计们,请让我知道eb可以做些什么:(