Random Quote Generator

Developer
Size
2,295 Kb
Views
8,096

How do I make an random quote generator?

Pressing a button generates a random quote from Forsimatic.com. What is a random quote generator? How do you make a random quote generator? This script and codes were developed by Tom Brodhead on 19 January 2023, Thursday.

Random Quote Generator Previews

Random Quote Generator - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Random Quote Generator</title> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Random Quote Generator</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div class="jumbotron"> <section> <h3>Your social media experience isn't complete without a random quote</h3> <br> <p style="margin-bottom:2em"><button id="generate-quotes">Generate Random Quote</button></p> <p id="quote" style="font-weight:bold; font-style:normal; font-size:16px" ></p> <p id="author" style="font-weight:bold; font-style:italic; font-size:16px"></p> </section> </div>
</div> <script src='https://code.jquery.com/jquery-3.1.1.min.js'></script>
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Random Quote Generator - Script Codes CSS Codes

body { margin-top: 60px; }

Random Quote Generator - Script Codes JS Codes

var d;d=function(){var a,b;a=function(a){return document.querySelector(a)};b=function(){var b,c;a("#quote").innerHTML="Loading...<br><br><em>(on CodePen this may take some time because of a cross-origin delay)</em>";a("#author").innerHTML="";$.ajax({type:"GET",url:"https://crossorigin.me/https://api.forismatic.com/api/1.0/?format=jsonp&method=getQuote&jsonp=?&lang=en",dataType:"json",success:function(e){b=e.quoteText;c=e.quoteAuthor;""===c&&(c="Unknown");a("#quote").innerHTML=b;a("#author").innerHTML=c},error:function(){console.log("Error retrieving JSON")}})};a("#generate-quotes").addEventListener("click",b,!1);b()};document.addEventListener("DOMContentLoaded",function(){d()});
Random Quote Generator - Script Codes
Random Quote Generator - Script Codes
Home Page Home
Developer Tom Brodhead
Username TomCodeCamp
Uploaded January 19, 2023
Rating 3
Size 2,295 Kb
Views 8,096
Do you need developer help for Random Quote Generator?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Tom Brodhead (TomCodeCamp) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!