Pokémon Viewer
About this app
View Pokémon by National Dex Number
Pokémon Viewer Pokémon Viewer Enter National Dex Number
Related apps
Put this on your site
Source
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Pokémon Viewer</title>
<meta name="description" content="View Pokémon by National Dex Number">
<meta name="keywords" content="Pokémon, National Dex Number, Image">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<script type="text/javascript">
try {
// App Javascript Goes Here. Place your entire script content inside the try block for error handling.
// This will run when the DOM is ready.
document.addEventListener("DOMContentLoaded", function() {
$("#pokemonForm").submit(function(event) {
event.preventDefault();
var nationalDexNumber = $("#nationalDexNumber").val();
getPokemon(nationalDexNumber);
});
function getPokemon(nationalDexNumber) {
// Fetch Pokémon data from an API
var apiUrl = "https://pokeapi.co/api/v2/pokemon/" + nationalDexNumber;
$.get(apiUrl, function(data) {
var pokemonName = data.name;
var pokemonImageUrl = data.sprites.front_default;
// Update the HTML with Pokémon name and image
$("#pokemonName").text(pokemonName);
$("#pokemonImage").attr("src", pokemonImageUrl);
});
}
});
} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>
<style>
/* App CSS Goes Here */
body {
background-color: #f8f9fa;
font-family: 'Roboto', sans-serif;
color: #333;
}
h1 {
text-align: center;
margin-top: 30px;
}
.pokemon-container {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50px;
}
.pokemon-image {
width: 200px;
height: 200px;
border-radius: 50%;
margin-bottom: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.pokemon-name {
font-size: 24px;
font-weight: bold;
text-align: center;
}
.form-container {
max-width: 400px;
margin: 0 auto;
margin-top: 50px;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.form-container h2 {
margin-bottom: 20px;
}
.form-container input[type="number"] {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.form-container input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
.form-container input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>Pokémon Viewer</h1>
<div class="form-container">
<h2>Enter National Dex Number</h2>
<form id="pokemonForm">
<input type="number" id="nationalDexNumber" min="1" max="1025" required>
<input type="submit" value="View Pokémon">
</form>
</div>
<div class="pokemon-container">
<h2 id="pokemonName"></h2>
<img id="pokemonImage" class="pokemon-image" src="" alt="Pokémon Image">
</div>
</div>
</body>
</html>
NEW APPS
These are apps made by the community!