Publicado el Jueves 08 de septiembre de 2005 a las 15:53:24 por krypton
Lecturas
Voy a poner este articulo, que e visto que piden mucho, sobre como enlazar dos cuadros desplegables con el resultado de dos tablas de bd, espero les sea util, funciona con asp y javascript y solo borrare algunas partes que no afecten la ejecución del porgrama y que no comprometa la seguridad de la compañia para que trabajo, el codigo es el siguiente: (la base de datos es sql server
Captura
// FUNCION DE COMBO BOX COMBINADO function validar(formulario) { var checkOK = "0123456789"; var checkStr = formulario.T1.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } allNum += ch; } if (!allValid) { alert("Escriba sólo números."); formulario.T1.focus(); return (false); } return (true); } function validar2(formulario) { var checkOK = "0123456789"; var checkStr = formulario.T2.value; var allValido = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValido = false; break; } allNum += ch; } if (!allValido) { alert("Escriba sólo números."); formulario.T2.focus(); return (false); } return (true); }
function ver1(clave) { Renglon="Servicios"; RengDet=document.getElementById(Renglon); RengDet.style.display=""; } function ver(clave) { Renglon="mes"; RengDet=document.getElementById(Renglon); RengDet.style.display=""; }
function sublist(inform, selecteditem) { inform.subcatagory.length = 0 var option = new Option('Escoje una opción',0); inform.subcatagory.options[inform.subcatagory.length]=option;
x = ;
subcat = new Array(); subcatagorys = ""; subcatagoryof = ""; subid= ""; subcat[x,0] = subcatagorys; subcat[x,1] = subcatagoryof; subcat[x,2] = subid; if (subcat[x,0] == selecteditem) { var option = new Option(subcat[x,1], subcat[x,2]); inform.subcatagory.options[inform.subcatagory.length]=option; }
}
function esconde(form) { if ((form.T1.value != "") && (form.T2.value != "")) { form.Enviar.style.visibility = "visible"; }