0
我有一個javascript函數從下面的選擇多個框A從數據庫填充到另一個多選框B,在B中回傳我的值的事件從A迷路了。最初我以爲因爲我爲服務器端操作包含了一個「runat =」server「」標記,但顯然情況並非如此。我閱讀了Form.Request,但沒有一個線索如何去做。我只需要在多個選擇框B中保留這些值。請提供建議。謝謝。在選擇多個框中保留值
<% - 移動物品來來回回的選擇框 - %>
function move(sourceFrom, sourceTo) {
var arrFrom = new Array();
var arrTo = new Array();
var arrLU = new Array();
var i;
for (i = 0; i < sourceTo.options.length; i++) {
arrLU[sourceTo.options[i].text] = sourceTo.options[i].value;
arrTo[i] = sourceTo.options[i].text;
}
var fLength = 0;
var tLength = arrTo.length;
for (i = 0; i < sourceFrom.options.length; i++) {
arrLU[sourceFrom.options[i].text] = sourceFrom.options[i].value;
if (sourceFrom.options[i].selected && sourceFrom.options[i].value != "") {
arrTo[tLength] = sourceFrom.options[i].text;
tLength++;
} else {
arrFrom[fLength] = sourceFrom.options[i].text;
fLength++;
}
}
sourceFrom.length = 0;
sourceTo.length = 0;
var ii;
for (ii = 0; ii < arrFrom.length; ii++) {
var no = new Option();
no.value = arrLU[arrFrom[ii]];
no.text = arrFrom[ii];
sourceFrom[ii] = no;
}
for (ii = 0; ii < arrTo.length; ii++) {
var no = new Option();
no.value = arrLU[arrTo[ii]];
no.text = arrTo[ii];
sourceTo[ii] = no;
}
(sourceTo).focus();
if (sourceTo == (document.getElementById('<%= outletFromBox.ClientID%>'))) {
(sourceFrom).focus();
}
if (sourceTo == (document.getElementById('<%= QualMemTypeFromBox.ClientID %>'))) {
(sourceFrom).focus();
}
if (sourceTo == (document.getElementById('MemStatusFromBox'))) {
(sourceFrom).focus();
}
}
<select multiple size="8" style="width: 135px" runat="server" onblur="selectAll(this, true, document.getElementById('<%#uilblDestinationQualOutlet.ClientID%>'))"
id="outletToBox">
</select>