Difference between revisions of "JavaScript Prompt"

From Level Access Web Labs
Jump to navigation Jump to search
Line 2: Line 2:
 
<script>
 
<script>
 
document.getElementById("b1").addEventListener("click",showPrompt)
 
document.getElementById("b1").addEventListener("click",showPrompt)
function showPrompt() {}
+
function showPrompt() {
var pizza = prompt("Please enter your Fav Pizza", "Veggie, cheese, etc.");
+
  var pizza = prompt("Please enter your Fav Pizza", "Veggie, cheese, etc.");
 
+
  if (person != null) {
if (person != null) {
+
    document.getElementById("demo").innerHTML =
  document.getElementById("demo").innerHTML =
+
    "Hello you like " + pizza + " ";
  "Hello you like " + pizza + " ";
+
  }
}
 
 
}
 
}
 
</script>
 
</script>

Revision as of 22:57, 7 February 2019