Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8"/>
- <title></title>
- </head>
- <body>
- <h1>Calculadora</h1>
- <img src="neutro.png" alt="calculadora flex" id="status">
- <form name="frmFlex">
- <input type="text" placeholder="Etanol" size="8" name="txtEtanol">
- <input type="text" placeholder="Gasolina" size="8" name="txtGasolina">
- <input type="button" value="Vantagem" onclick="calcular()">
- <input type="reset" value="Limpar" onclick="resetar()">
- </form>
- <script src="arquivo.js"></script>
- </body>
- </html>
- var etanol,gasolina;
- function calcular(){
- etanol = parseFloat(frmFlex.txtEtanol.value.replace(",","."));
- gasolina = parseFloat(frmFlex.txtGasolina.value.replace(",","."));
- if(etanol < 0.7 * gasolina){
- document.getElementById("status").src="etanol.jpeg";
- }else{
- document.getElementById("status").src="gasolina.jpg";
- }
- }
- function resetar(){
- document.getElementById("status").src="neutro.png";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement