Ticker

10/recent/ticker-posts

Programming


   <button onclick="myFunction()">Click Here</button>

<p id="demo"></p><p>
<script>
  function myFunction(){
let text;
let p=prompt("Please enter your name:");
    if (p==null||p==""){
    text="User cancelled the prompt.";
    }else{
      text="Hello Mr. "+p+"! How are you today?";
      }
      document.getElementById("demo").innerHTML=text;
    
  }
</script>
 

 

Post a Comment

0 Comments