Ver Mensaje Individual
  #209 (permalink)  
Antiguo 05/04/2005, 14:01
Avatar de programeitor
programeitor
 
Fecha de Ingreso: febrero-2005
Mensajes: 994
Antigüedad: 19 años, 2 meses
Puntos: 9
211. Como definir estilos por tipo

P:Como definir estilos por tipo.

R:Mediante una funcion llamada en el onload.

<html>
<head>
<script>
function
EstiloPorTipo(marca,tipo,estilo){// programeitor 2005, [email protected]
var e=estilo.split(',');
var m=document.getElementsByTagName(marca)
;
for(var n=0;n<m.length;n++){

if(m[n].type==tipo){
for(var i=0;i<e.length;i+=2){
m[n].style[e[i]]=e[i+1];
}

}
}
}
</script>
</head>
<body onload=EstiloPorTipo('input','text','background,red,width,200px')>
<input type="text" value="asd">
<input type="button" value="asd">

</body>
</html>


Última edición por programeitor; 17/10/2005 a las 18:54