1
Good morning, good afternoon and good night!
I’m developing a cli style question and answer game in HTML and Javascript. But my javascript function does not display the answer on the screen. Follows the code:
funcaoJogo = function(){
document.getElementById('tela').innerText = document.getElementById('inputValor').value;
alert("Bem vindo a Cidade das Batalhas");
}
body {
background-color: gray;
color: white;
}
div#tela {
margin: auto;
padding: auto;
background-color: black;
width: 640px;
height: 480px;
overflow: auto;
color: white;
text-align: center;
}
div#resposta {
margin: auto;
padding: auto;
background-color: #B22222;
width: 640px;
height: 25px;
}
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>IA GAME</title>
<link rel="stylesheet" type="text/css" href="css2/newCss.css">
<script type="text/javascript" src="javascript2/newJavascript.js"></script>
</head>
<body>
<div id="tela">
</div>
<div id="resposta">
<center>
Jogador Nº1:
<input id="inputValor" type="text" name="">
<button id="enviar" onclick="funcaoJogo">Desafiar</button>
</center>
</div>
</body>
</html>
If anyone can help me thank you! Thanks, said!