Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript">
- function convertir(){
- var accion = document.getElementById("selector");
- var cantidad = document.getElementById("importe").value;
- if (accion.value=="p2e"){
- document.getElementById("resultado").value =
- Math.round(parseInt(cantidad) / 166.386);
- }
- if (accion.value=="e2p"){
- document.getElementById("resultado").value =
- Math.round(parseInt(cantidad) * 166.386);
- }
- }
- </script>
- </head>
- <body>
- <form name="conversor">
- <table border=0>
- <tr>
- <td><label for="importe">Importe a convertir</label></td><td><input type="text" name="importe" id="importe" /></td>
- </tr>
- <tr>
- <td><label for="resultado">Resultado</label></td><td><input type="text" name="resultado" id="resultado" /> </td>
- </tr>
- <tr>
- <td colspan=2>
- <select id="selector">
- <option value="p2e">Pesetas a euros</option>
- <option value="e2p">Euros a pesetas</option>
- </select>
- </td>
- </tr>
- <tr>
- <td align="center" colspan=2><input type="button" value="Convertir"
- onClick="convertir()" /></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement