Montei esse código para estudos, mas quando executo ele a idade junto com a mensagem não aparece, olhei no console lá fala que o problema esta no segundo value, quando tiro ele aparece: usuário possuí null anos
.
function enviar() {
var nome = document.getElementById("text").value;
document.write("Welcome, ", nome);
var idade = document.getElementById("idade1").value;
document.write("<br>O usuário possuí ", idade, " anos");
}
<!DOCTYPE html>
<html>
<TItle>teste Prompt</TItle>
<meta charset="utf-8">
<meta name="PROMPT" content="TESTANDO">
<style>
.container {
margin: 0 auto;
width: 940px;
}
.inicio {
font-size: 30px;
}
</style>
<head>
</head>
<body>
<div class="inicio container">
<form>
<H2>nome</H2>
<input id="text" type="text">
<h2>idade</h2>
<input id="idade1" type="number">
<button onclick="enviar()">Confirmar</button>
<script>
</script>
</div>
</body>
</html>