JavaScript - Problemas con dos funciones

 
Vista:

Problemas con dos funciones

Publicado por Joan Carles (12 intervenciones) el 20/02/2007 14:51:08
Hola a todos;
El problema que tengo es el siguiente: Tengo dos funciones que si las utilizo, solas funcionan perfectamente, el problema que hay es cuando las utilizado las dos en el mismo evento; y no se como juntarlas, el codigo es el siguiente:

<html>
<title> </title>
<head>
<script>
function nomesnumeros(e)
{
var key;
if(window.event) // IE
{
key = e.keyCode;
}
else if(e.which) // Netscape/Firefox/Opera
{
key = e.which;
}
if ((key < 48 || key > 57 || key == 40 || key == 41 || key == 44) && key != 45 && key != 8)
{
return false;
}else{
return true;
}
}
function control(e)
{
var tecla;
if(window.event) // IE
{
tecla = e.keyCode;
}
else if(e.which) // Netscape/Firefox/Opera
{
tecla = e.which;
}
if( (tecla == 116 || tecla == 118 || tecla == 120 || tecla == 122) && (tecla == 17 || tecla == 18 || tecla == 19 || tecla == 20))
{
return true;
}else{
return false;
}
}
</script>
</head>
<body>
<input name="Num" type="text" id="Num" onkeypress ="return nomesnumeros(event); control(event);"/>
<input name="" type="text" id="" class="" />
</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder