Tuesday, May 27, 2014

Can user enter values in javascript alert?

var person=prompt("Please enter your name","Harry Potter");

if (person!=null)
  {
  x="Hello " + person + "! How are you today?";
  document.getElementById("demo").innerHTML=x;
  }

No comments:

Post a Comment