Respostas no Fórum
-
AutorPosts
-
Pedro Henrique Peres
Participante<!DOCTYPE html>
<html lang=”pt-BR”>
<head>
<meta charset=”UTF-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Document</title>
</head>
<body>
<h1>Sistema de multas</h1>
Velocidade do carro : <input type=”number” name=”txtvel” id=” txtvel” > Km/h<input type=”button” value=”verificar” onclick=”calcular()”>
<div id=”res” >
</div>
<script>function calcular(){
var txtv = window.document.getElementsByTagName(‘txtvel’)
var res = window.document.querySelector(‘div#res’)
var vel = Number(txtv.value)
res.innerHTML =Sua velocidade atual é ${vel}VARIAVEL APARECE COMO ‘NaN
}
</script>
</body>
</html>Pedro Henrique Peres
Participantenão imprime o valor da velocidade na tela.
aparece como NaN
<body>
<h1>Sistema de multas</h1>
Velocidade do carro : <input type=”number” name=”txtvel” id=” txtvel” > Km/h<input type=”button” value=”verificar” onclick=”calcular()”>
<div id=”res” >
</div>
<script>function calcular(){
var txtv = window.document.getElementsByTagName(‘txtvel’)
var res = window.document.querySelector(‘div#res’)
var vel = Number(txtv.value)
res.innerHTML =Sua velocidade atual é ${vel} -
AutorPosts