Showing posts with label phpecho. Show all posts
Showing posts with label phpecho. Show all posts

Sunday, June 29, 2025

Random Quotes Generator


 

Code:

<script>
    function getq(){
        const quotes = ["A","B","C","D","E","F"];
        const colr= ["red","green","black","pink"];
        var x = Math.floor(Math.random()*quotes.length);
        document.getElementById("show").innerText = quotes[x];
        document.getElementById("show").style.backgroundColor = colr[x];
        document.getElementById("show").style.color = "white";


// alert(quotes[4]);

    }
</script>

<div id="show"></div>
<input type="button" onclick="getq()" value="Generate Quotes">

See video - Go to video

Custom method using prototype in JavaScript.

<!DOCTYPE html> <html> <head>   <title>Custom Prototype Method</title> </head> <body>   <h2>...