JavaScript中的提示用戶輸入對話框prompt使用代碼演示

<!DOCTYPE html> <html> <body> <p>Click the button to demonstrate the prompt box.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var x; var person=prompt("Please enter your name","Sharejs.com"); if (person!=null)   {   x="Hello " + person + "! How are you today?";   document.getElementById("demo").innerHTML=x;   } } </script> </body> </html> //該代碼片斷來自於: http://www.sharejs.com/codes/javascript/7831
相關文章
相關標籤/搜索