Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/05/2011, 14:45
Avatar de ing_green_hornet
ing_green_hornet
 
Fecha de Ingreso: abril-2011
Mensajes: 8
Antigüedad: 13 años
Puntos: 0
Consulta Para Hacer Script Compatible con Los Navegadores

Hola Que Tal?

Mi duda Es la siguiente. que tendria que modificar en este script para
hacerlo compatible con la mayoria de los navegadores, puesto que solo funciona para IE. el script es para hacer una multiple seleccion e intercambiar valores entre combobox.


Código:
// JavaScript Document
function moveVals(n, from, to) 
{
 if (document.layers) 
 {
 fromObj = document.layers[from];
 to = document.layers[to];
 }
 else if (document.all) 
 {
 fromObj = document.all(from);
 to = document.all(to);
 }
 if (n == 1 || n == 2) 
 {
 var indTo = to.length-1;
 for (i=fromObj.length-1; i>=0; i--) 
  {
  if (n==1 || fromObj.options[i].selected) 
   {
	indTo++;
	to.options[indTo] = new Option(fromObj.options[i].text, fromObj.options[i].value);
	fromObj.options[i] = null;
   }
  }
 } 
 else if (n == 3 || n == 4) 
 {
 var indFrom = fromObj.length-1;
 for (i=to.length-1; i>=0; i--) 
  {
   if (n==4 || to.options[i].selected) 
   {
   indFrom++;
   fromObj.options[indFrom] = new Option(to.options[i].text, to.options[i].value);
   to.options[i] = null;
   }
  }
 }
}

function frmButtons() 
{
 var select = "chosen[]";
 var avail = "avail[]";
 if (document.layers) 
 {
  var sel = document.layers[select];
  var av = document.layers[avail];
 } 
 else if (document.all) 
 {
  var sel = document.all(select);
  var av = document.all(avail);
 }
 if (sel.length <= 0) 
 {
  document.formulario.btnR.disabled = true;
  document.formulario.btnRR.disabled = true;
 } 
 else 
 {
  document.formulario.btnR.disabled = false;
  document.formulario.btnRR.disabled = false;
 }
 if (av.length <= 0) 
 {
  document.formulario.btnL.disabled = true;
  document.formulario.btnLL.disabled = true;
 } 
 else 
 {
  document.formulario.btnL.disabled = false;
  document.formulario.btnLL.disabled = false;
 }
}

function deleteFrom() 
{
 for (i=0; i<document.formulario.elements.length-1; i++) 
 {
  if(document.formulario.elements[i].id.indexOf("SELECT") && document.formulario.elements[i].id.indexOf("av")) 
  {
   alert("Cislo: "+i+" name: "+document.formulario.elements[i].tagname);
  }
 }
}
De Antemano, Muchas Gracias