<!DOCTYPE html>
<html>
<head>
<title>Get Stock Price</title>
</head>
<body>
<h1>Consultar Precio de Acción</h1>
<input type="text" id="stockName" placeholder="Ej: AAPL" />
<button onclick="getStockPrice()">Consultar</button>
<p id="result"></p>
<script>
function getStockPrice() {
const stockName = document.getElementById("stockName").value;
const resultElement = document.getElementById("result");
// Opción con mock manual (funciona como servidor ficticio: http://www.example.org/stock para que de un resultado.)
const mockPrice = (Math.random() * 200).toFixed(2);
resultElement.innerHTML = `Precio de ${stockName}: $${mockPrice}`;
}
</script>
</body>
</html>