Search
 
SCRIPT & CODE EXAMPLE
 

HTML

html chatbot

<!DOCTYPE html>
<html>
<body>
<style>
button {
  background-color: dodgerblue;
}
p {
  text-align: center;
}
</style>

<p><button onclick="myFunction()">Click here to wake me up</button></p>

<p id="demo"></p>

<script>
function myFunction() {
  var text;
  var ms = prompt("Ask me anything.");
  switch(ms) {
    case "hello":
      text = "HI, What do you want to ask me?";
      break;
    case "how are you":
      text = "I am fine. Hope you are fine too.";
      break;
    case "hi":
      text = "Yes. What do you want to ask?";
      break;
    case "hey":
      text = "Yes. What do you want to ask?";
      break;      
    case "yes":
      text = "Okay. So what do you want to ask?";
      break;
    case "search":
      text = '<form action="https://www.google.com/search" target="_blank"><input name="q" size="50" placeholder="type your search term and click enter"></form>';
      break;
    case "functions":
      text = "I can help you to find answers to your questions, I can give the weather report , I can show you the current time";
      break;      
    case "weather":
      text = '<a href="https://www.accuweather.com/en/us/google/94043/weather-forecast/74907_poi" target="_blank">Weather report</a>';
      break;     
    case "time":
      text = new Date().toLocaleTimeString();
      break;
    default:
      text = "I didn't understand that";
  }
  document.getElementById("demo").innerHTML = text;
}
</script><hr>

<p>TYPE hello, how are you, hi, hey, yes, search, functions, weather, time etc.</p>

</body>
</html>
Comment

chatbot html


<body>
 
    <mybot></mybot>

  </div>

  <script src="https://ajax.********************ery.min.js"></script>
  <script src="assets/js/script.js"></script>
</body>
Comment

PREVIOUS NEXT
Code Example
Html :: static html template 
Html :: angularjs call js function 
Html :: change the font-size on a label html 
Html :: print html table 
Html :: href action syntax 
Html :: in html 
Html :: dir in html 
Html :: html height percentage not working 
Html :: input radio button html 
Html :: source html 
Html :: html aside tag example 
Html :: dropdown 
Html :: bell bootstrap 
Html :: toptal html interview questions 
Html :: html multi like tag indentation convention 
Html :: file read from outbox 
Html :: how to 
Html :: js does a return stop a while 
Html :: where to store nft art 
Html :: komodo ide 13 
Html :: 11ty do not output writing file to terminal 
Html :: textarea set character limit 
Html :: what is class attribute in form 
Html :: Open Dropdown pop up upwards forcely 
Html :: gambar html 
Html :: phpstrom goto bookmark 
Html :: display sqlite text with jinja as HTML paragraph 
Html :: create a portfolio website with html css 
Html :: how to make option values contain spaces in html 
Html :: react three fiber text font family 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =