Guest User

Pixel (Html chatbot) source code

a guest
Oct 10th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Pixel</title>
  5.     <link rel="shortcut icon" href="Icon.gif">
  6. </head>
  7. <body>
  8. <h2>Pixel</h2>
  9. <h5 id="basicInfo">Please use lowercase letters. Please don't use symbols.</h5>
  10. <input type="text" title="Pixel" placeholder="Type here" class="ChatBot" id="getValue"><br>
  11. <input type="button" value="Say to pixel" id="getData" onclick="cSearch()">
  12. <script type="text/javascript">
  13.     function cSearch()
  14.     {
  15.         var get = document.getElementById("getValue").value;
  16.         if (get.includes("hello") || get.includes("hey") || get.includes("hi"))
  17.         {
  18.             alert("Hey! How are you?");
  19.         }
  20.  
  21.         else if (get.includes("how are you"))
  22.         {
  23.             alert("I'm fine thanks for asking =)");
  24.         }
  25.  
  26.         else if (get.includes("m fine"))
  27.         {
  28.             alert("Sounds good =)");
  29.         }
  30.  
  31.         else if (get.includes("what is your name") || get.includes("who are you"))
  32.         {
  33.             alert("My name is Pixel =)");
  34.             alert("I am here to talk with you.")
  35.         }
  36.  
  37.         else if (get.includes("what is your gender") || get.includes("are you a boy") || get.includes("are you a girl"))
  38.         {
  39.             alert("I'm a boy.");
  40.         }
  41.  
  42.         else if(get.includes("what can you do for me"))
  43.         {
  44.             alert("I can do anything that you ask.");
  45.             alert("Just tell open and the command you want to launch.");
  46.         }
  47.  
  48.         else if(get.include("open google"))
  49.         {
  50.             window.open("https://www.google.com","_blank");
  51.         }
  52.  
  53.         else if (get.include("open yahoo"))
  54.         {
  55.             window.open("https://www.yahoo.com","_blank");
  56.         }
  57.  
  58.         else if (get.include("open microsoft"))
  59.         {
  60.             window.open("https://www.microsoft.com","_blank");
  61.         }
  62.  
  63.         else if (get.include("open apple"))
  64.         {
  65.             window.open("https://www.apple.com","_blank");
  66.         }
  67.  
  68.         else if (get.include("open youtube"))
  69.         {
  70.             window.open("https://www.youtube.com","_blank");
  71.         }
  72.  
  73.         else if (get.include("open scratch"))
  74.         {
  75.             window.open("https://scratch.mit.edu","_blank");
  76.         }
  77.  
  78.         else if (get.include("open wikipedia"))
  79.         {
  80.             window.open("https://www.wikipedia.org/","_blank");
  81.         }
  82.  
  83.         else if (get.include("open britannica"))
  84.         {
  85.             window.open("https://www.britannica.com/","_blank");
  86.         }
  87.  
  88.         else if (get.include("open reddit"))
  89.         {
  90.             window.open("https://www.reddit.com/","_blank");
  91.         }
  92.  
  93.         else if (get.include("open facebook"))
  94.         {
  95.             window.open("https://www.facebook.com/","_blank");
  96.         }
  97.  
  98.         else if (get.include("open twitter"))
  99.         {
  100.             window.open("https://twitter.com/","_blank");
  101.         }
  102.  
  103.         else if (get.include("black amazon"))
  104.         {
  105.             window.open("https://www.amazon.com/","_blank");
  106.         }
  107.  
  108.         else if (get.include("bye"))
  109.         {
  110.             alert("Fine =)");
  111.             alert("See you later.")
  112.         }
  113.  
  114.         else
  115.         {
  116.  
  117.             alert("Sorry! I can't understand you =(");
  118.         }
  119.     }
  120. </script>
  121. <style type="text/css">
  122.     body
  123.     {
  124.         background-image: url("Background.jpg");
  125.         background-size: 100%;
  126.     }
  127.  
  128.     h2
  129.     {
  130.         color: #e7e7e7;
  131.         text-align: center;
  132.         font-style: italic;
  133.         font-family: sans-serif;
  134.         cursor: pointer;
  135.         transition: 0.8s;
  136.     }
  137.  
  138.     h2:hover{
  139.         color: #2C363F;
  140.     }
  141.  
  142.     .ChatBot
  143.     {
  144.         background-color: #2c2c2c;
  145.         color: #e7e7e7;
  146.         border-radius: 50px;
  147.         border: none;
  148.         text-align: center;
  149.         position: absolute;
  150.         top: 50%;
  151.         left: 50%;
  152.         transform: translate(-50%, -50%);
  153.         width: 50%;
  154.         height: 25px;
  155.         transition: 0.8s;
  156.         text-align: center;
  157.     }
  158.  
  159.     .ChatBot:hover
  160.     {
  161.         background-color: #2C363F;
  162.     }
  163.  
  164.     #basicInfo
  165.     {
  166.         color: #e7e7e7;
  167.         position: absolute;
  168.         top: 92%;
  169.         left: 12%;
  170.         transform: translate(-40%, -48%);
  171.     }
  172.  
  173.     #getData
  174.     {
  175.         background-color: #2c2c2c;
  176.         color: #e7e7e7;
  177.         border-radius: 50px;
  178.         border: none;
  179.         position: absolute;
  180.         top: 60%;
  181.         left: 51%;
  182.         transform: translate(-60%,-51%);
  183.         width: 10%;
  184.         height: 30px;
  185.         transition: 0.8s;
  186.         text-align: center;
  187.         cursor: pointer;   
  188.     }
  189.  
  190.     #getData:hover
  191.     {
  192.         background-color: #2C363F;
  193.         /*color: #2c2c2c;*/
  194.     }
  195. </style>
  196. </body>
  197. </html>
  198.  
Add Comment
Please, Sign In to add comment