Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: move register

  1. #1
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    move register

    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


    Code:
    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);
    		}
    		
    
    	}

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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?
    Last edited by Kor; 04-24-2008 at 03:16 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Code:
    <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.

    Code:
       <%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

  • #4
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    personally I would use

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

    and to remove all of the options

    mySelectObj.options.length = 0;

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •