Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/04/2009, 10:41
zodgyy
 
Fecha de Ingreso: febrero-2008
Ubicación: Mexico, D.F.
Mensajes: 23
Antigüedad: 16 años, 3 meses
Puntos: 0
Problema con CSS en Jquery que se encuentra en otro JS

Hola a todos

Tengo un problema con una funcion que debe de verificar que tenga dato el elmento y al no tener debe de mandar mensaje y cambiar propiedad CSS y dar el foco. Bueno les explico:

Cargo el Jquery y pagina de funciones en la pagina.
Invoco la funcion y me funciona bien solo NO me cambia la propiedad CSS y no me da el foco al elemento.

Podrian decirme en que estoy mal??

GRACIAS

Pag. Principal
<html>
<head>
<title>Titulo</title>
<script type="text/javascript" src="../Connection/jquery.js"></script>
<script type="text/javascript" src="../Connection/herramientas.js"></script>
</head>

<body>
<form id="frm" action"#">
<table>
<tr>
<td><input type="button" value="click me" id="Click" onClick="javascript:Necesario('selecto','Texto a Mostrar.',1)">
</td>
<td>
<select id="selecto">
<option value="">seleccion</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
</tr>
</table>
</form>
</body>
</html>


Pag. herramientas
function Necesario(nomObj,Texto,foco){

$(':input').each(function() {
var type = this.type
var id = this.id

if(type=='radio' || type=='checkbox'){ //radios y checkbox
if(id==nomObj){
if(!$(nomObj).is(':checked')){

$(nomObj).css({'background-color' : 'yellow'});

if(parseInt(foco)!= 0){ $(nomObj).focus()}

alert(Texto)

return false
}else{
return false
}
}
}else if (type=='text' || type=='textarea' || type=='select-one' || type=='select-multiple'){
//objetos restantes
if(id==nomObj){
if($(nomObj).val()=="" || $(nomObj).val()==undefined){

$(nomObj).css({'background-color' : 'yellow'});

if(parseInt(foco)!= 0){ $(nomObj).focus()}

if(Texto != ""){
alert(Texto)
}

return false
}else{
return true
}
}
}
});
}