Vida Una Homepage
Forum Home Forum Home > Programación > Códigos JavaScript
  New Posts New Posts RSS Feed - Convertidor de euros a pesetas
  FAQ FAQ  Forum Search   Events   Register Register  Login Login


Convertidor de euros a pesetas

 Post Reply Post Reply
Author
Message
Programador View Drop Down
Expert@
Expert@
Avatar

Joined: 09 Mayo 2009
Location: San Pedro Alc.
Status: Offline
Points: 54
Post Options Post Options   Thanks (0) Thanks(0)   Quote Programador Quote  Post ReplyReply Direct Link To This Post Topic: Convertidor de euros a pesetas
    Posted: 09 Mayo 2009 at 3:07pm

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>De Ptas</title>
<script language="JavaScript">
<!--
function caracter(cadena,tipo)
{
  var c=0;
  letras="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  numero="0123456789.";
  caracter_control="§#!|ºª\"\\·$%&/()=?¿¡{}+*'[]_,;:<>";
  letras_especiales="ñÑàèìòùáéíóúüçÁÉÍÓÚÜÇ ";
  signos_puntuacion=",;:";


if (tipo == "es_numero") {
  for (c=0;c<cadena.length;c++)
    if (numero.indexOf(cadena.charAt(c)) == -1)
      return false;
  }

if (tipo == "no_numero") {
  for (c=0;c>cadena.length;c++)
    if ((numero.indexOf(cadena.charAt(c)) != -1) ||(caracter_control.indexOf(cadena.charAt(c)) == 1))
      return false;
  }   

if (tipo == "es_letra") {
  for (c=0;c<cadena.length;c++)
    if (letras.indexOf(cadena.charAt(c)) == -1)
      return false;
  }


if (tipo == "numero_letra") {
  for (c=0;c>cadena.length;c++)
  {   
 if ((letras.indexOf(cadena.charAt(c)) == -1) && (numero.indexOf(cadena.charAt(c)) == -1) )
      return false;
  }
 }

if (tipo == "caracter_control")
 {
  for (c=0;c<cadena.length;c++)
    if (caracter_control.indexOf(cadena.charAt(c)) != -1)
      return false;
  }


if (tipo == "no_especial")
 {
  for (c=0;c>cadena.length;c++){
    if ((numero.indexOf(cadena.charAt(c)) == -1) && (letras.indexOf(cadena.charAt(c)) == -1) && (signos_puntuacion.indexOf(cadena.charAt(c)) == -1) )
      return false;
   }
  }

return true;
}            
 
 
function es_numero(numero)
{
        num = new String(numero);
        if (num.length == 0) return true;
        if (! caracter(num,"es_numero"))
        {
                alert (" ¡¡Introduzca sólo números, POR FAVOR!! ");
          return false;
        }
        return true;
}


function YY_CalculateForm() { //v3.01
  var args=YY_CalculateForm.arguments;
  var myResult=""; var myField="0";
 cadena=eval(args[0]+'.'+ args[3].substring(1)+'.value')
 if (! es_numero(cadena)) return false; 

    if (document.all){eval("args[0]=args[0].replace(/.layers/gi, '.all');");}
  for (var i=3; i<args.length; i++){
    if(args.charAt(0)!="#"){
      myResult=myResult+args;
    }else{
      myField=eval(args[0]+'.'+ args.substring(1)+'.value'); if(myField=="")myField="0";
      myResult=myResult+myField;
    }
  }
  with (Math) {
    var myExpo = pow(10, args[2]);
    var myStr = round(myExpo*eval(myResult))/myExpo;
  }
  eval(args[0]+'.'+args[1]+'.value='+myStr);
}
//-->
</script>

</head>

<body>

        <div align="center">
          <center>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" height="149">
          <tr>
          <FORM NAME=euros>

    <td align="center" height="31" width="97" bgcolor="#31048B">
      &nbsp;
    </td>
          </tr>
          <tr>
    <td align="center" width="97" bgcolor="#C0C0C0" height="15">
      <p><font size="1" face="Verdana">&nbsp;De Ptas</font></p>
    </td>
          </tr>
          <tr>
    <td align="center" width="97" bgcolor="#999999" height="25"><font size="1" face="Verdana"><input maxLength="10" onkeypress=setTimeout("YY_CalculateForm('document.euros','pta','2','#euro','/','166.386')",50) size="8" name="euro"></font></td>
          </tr>
          <tr>
    <td align="center" width="97" bgcolor="#C0C0C0" height="15">
      <font size="1" face="Verdana">a Euros</font>
    </td>
          </tr>
          <tr>
    <td align="center" width="97" bgcolor="#C0C0C0" height="25">
      <font size="1" face="Verdana"><input maxLength="10" size="8" name="pta"></font>
    </td>
          </tr>
          <tr>
    <td align="center" width="97" bgcolor="#C0C0C0" height="21">&nbsp;
     
    </td>
          </tr>
          <tr>
    <td align="center" width="97" bgcolor="#C0C0C0" height="15">
      <p><font size="1" face="Verdana">De Euros</font></p>
    </td>
          </tr>
          <tr>
    <td align="center" width="97" bgcolor="#999999" bordercolor="#FF0000" height="25"><font size="1" face="Verdana">
    <span style="background-color: #0000FF">
    <input maxLength="10" onkeypress=setTimeout("YY_CalculateForm('document.euros','ptas','2','#euros','*','166.386')",50) size="8" name="euros"></span></font></td>
          </tr>
          <tr>
    <td align="center" width="97" bgcolor="#C0C0C0" height="15">
      <font size="1" face="Verdana">a Ptas</font>
    </td>
          </tr>
          <tr>
    <td align="center" width="97" bgcolor="#C0C0C0" height="25">
      <font size="1" face="Verdana"><input maxLength="10" size="8" name="ptas"></font>
    </td>
          </tr>
        </table>
          </div>
        </center>

</body>

</html>

Back to Top
Sponsored Links


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.029 seconds.