Difference between revisions of "JavaScript Prompt"

From Level Access Web Labs
Jump to navigation Jump to search
Line 1: Line 1:
 
<html>
 
<html>
 
<script>
 
<script>
 +
document.getElementById("b1").addEventListener("click",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.");
  
Line 6: Line 8:
 
   document.getElementById("demo").innerHTML =
 
   document.getElementById("demo").innerHTML =
 
   "Hello you like " + pizza + " ";
 
   "Hello you like " + pizza + " ";
 +
}
 
}
 
}
 
</script>
 
</script>
 +
<body>
 +
<button id="b1">Display prompt</button>
 +
</body>
 
</html>
 
</html>

Revision as of 22:56, 7 February 2019