...

View Full Version : move register



FlashO
04-24-2008, 12:17 PM
Hi กกก
I have this code for move all register in a multiselect. My problem is that this code work perfect in Internet Explorer but no work in firefox. Because???
Can you help me please??
Thankssssss
:thumbsup:




function anadirTodos(val) {
var newOpt
for (k=0;k<val.lista.length;k++) {
newOpt = document.createElement("OPTION");
newOpt.text = val.lista.options[k].text;
newOpt.value = val.lista.options[k].value;
val.seleccionados.options.add(newOpt,val.seleccionados.length);
//val.lista.options.remove(k);
}

for (k=0;k<val.lista.length;) {
val.lista.options.remove(k);
}


}


function anadirTodos2(val) {
var newOpt
for (k=0;k<val.lista2.length;k++) {
newOpt = document.createElement("OPTION");
newOpt.text = val.lista2.options[k].text;
newOpt.value = val.lista2.options[k].value;
val.seleccionados2.options.add(newOpt,val.seleccionados2.length);
//val.lista.options.remove(k);
}

for (k=0;k<val.lista2.length;) {
val.lista2.options.remove(k);
}


}

Kor
04-24-2008, 03:13 PM
What is the passed argument val? Should be the FORM as an element, not its name or id.

Can we see how you call the function in the HTML code? Can we see the list box HTML code?
---
Anyway, the code looks bizarre from a strict DOM point of view. Can you detail what in fact that code supposes do do?

FlashO
04-24-2008, 06:21 PM
<input name="addAll" type="button" id="addAll" value=">>" onClick="anadirTodos(this.form)">


The code passes all records of a box to another in a select multiple.



<%Set RsS = CreateObject("ADODB.RecordSet")
DnsText2 = "****************************"
SqlText2 = "SELECT * FROM Tags WHERE tipo=0 order by Nombre ASC"
RsS.Open SqlText2, DnsText2, 3,3

%>
<%if identificador="" then
%>
<select name="lista" class="textonormal" id="lista" size="15" style=" font-size:9px;width:200px " multiple ondblclick="anadir(this.form)">
<%do while not rsS.eof%>
<% if rsS("tipo")=0 then%>
<option value=<%=rsS("id")%>><%=rsS("Nombre")%></option>
<%end if%>
<%rsS.movenext
loop
rsS.close
%>
</select>



list is a table of my database

A1ien51
04-24-2008, 08:20 PM
personally I would use

var newOpt = new Option("text","value");

and to remove all of the options

mySelectObj.options.length = 0;

Eric



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum