LibraryJtS.js

Páginas: 2 (326 palabras) Publicado: 22 de marzo de 2013
/* Hola ESTE CODIGO no tiene Copying usalo si lo quieres o si lo entiendes no tengo problemas con esto todos podemos usarlo ya sea para aprender algo nuevo o resolver que es lo importante en elmomento verdad. Bueno lo Hice yo Julio Olivares Tejeda Sanchez APRENDIS DESARROLLADOR WEB*/
function iniciar(funcion0)
{
addEvento(window, 'load', funcion0, false);
} //funcion que inicializalos eventos cuando se carga la pagina completa;
function addEvento(elemento, evento, funcion, captura)
{
try {
elemento.addEventListener(evento, funcion, captura);
returntrue;d
}
catch (e)
{
try
{
elemento.attachEvent('on' + evento, funcion);
return true;
}
catch (e)
{alert(e);
}
}
}//FUNCTION AGREGAR EVENTOS A LOS ELEMENTOS
var objeto;
var valida=false;
function aplicarEvento(atributoId,atributoClassTag,clase,eventox,funcionx) //tosos sonestring,,, menos la funcion,
{
if(atributoId!=null)
{
objeto = document.getElementById(atributoId);
if(!objeto){ return valida=false;
}addEvento(objeto,eventox,funcionx,false);
return;
}
else if(atributoClassTag!=null)
{objeto=document.getElementsByTagName(atributoClassTag);
var elementosX=objeto;
for(i=0; i < elementosX.length;i++)
{ var elementosY =elementosX[i];
if(elementosY.className == clase)
{
addEvento(elementosY,eventox,funcionx,false);}
if(i==elementosX.length)
{ break;}else { continue; }
}
}
}//APLICAR EVENTOS A ELEMENTOS POR ID O CLASE
function validarFrm(idCampo,tipo)

{
var campo=document.getElementById(idCampo);
if(!campo){returnvalida=false;}
else{var tipoCampo=campo.getAttribute('type');
if(tipo!=tipoCampo && !tipo)
{
return valida=false;
}
else{
switch(tipo)
{case'text':{...
Leer documento completo

Regístrate para leer el documento completo.

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS