如何使用 jquery 创建弹出窗口 window 要求输入

How to create a pop up window asking for input using jquery

我的index.html代码是

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Ember Starter Kit</title>
  <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/one.css">
</head>
<body>

<!--Script1-->

  <script type="text/x-handlebars">
    <div id="W">
<h1> Welcome </h1>
</div>

<div id="section1">
<h2>   {{#link-to 'DINESH'}} DINESH {{/link-to}}  </h2>
</div>

<div id="section">
<h2> {{#link-to 'HOME'}} HOME {{/link-to}} </h2> 
</div>

<div id="section2">
<h2> {{#link-to 'CLICK'}} CLICK {{/link-to}} </h2> 
</div> 

 {{outlet}}

  </script>

  <!--Script2-->

  <script type="text/x-handlebars" id='HOME'>
  <div class-'HOME'>
  <p>
    This is a sample site for practicing Ember.js 
  </p>
  </script>

  <!--Script3-->

   <script type="text/x-handlebars" id='DINESH'>
  <div class-'DINESH'>
  <p>
     I welcome you to my page.. keep in touch......!!!!!
  </p>
  VIDIYAL
<br>

   Being the "Director of Community Service" in Rotaract Club of Future League, I organised a project called "VIDIYAL" where i taught basic computer knowledge to Orphanage Students. 
  </script>

  <!--Script4-->

  <script type="text/x-handlebars" id='CLICK'>

<div class-'CLICK'>
<p> Click the button to display the information which you want: </p>

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

<p id="CLICK"></p>

<script>
function myFunction() {
    document.getElementById("demo").innerHTML = "Hello World";
}



  </script>


  <script src="js/libs/jquery-1.10.2.js"></script>
  <script src="js/libs/handlebars-v2.0.0.js"></script>
  <script src="js/libs/ember-1.9.1.js"></script>
  <script src="js/app.js"></script>
  <!-- to activate the test runner, add the "?test" query string parameter -->
  <script src="tests/runner.js"></script>
</body>
</html>

和app.js代码是

App = Ember.Application.create();

App.Router.map(function()
{
    this.resource('HOME');
    this.resource('DINESH');
    this.resource('CLICK');
});

如果我单击它应该会显示一个弹出窗口 window 询问我的名字 ("Enter your name")。

我是一名刚接触编程的学生。请尽可能简单地向我解释一下。

您可以在jquery或js中使用prompt()函数来接收弹窗中的输入。查看代码-:

<script>

var childAge =  prompt("Enter Child  age")
alert(childAge);

</script>

您完全可以做到这一点 javascript。 prompt() 方法将为您执行此操作。 检查 here

如果您想在 Ember.js 中执行此操作,您需要在用户点击时打开模式。 创建了 Fiddle http://jsfiddle.net/rocky_217/uxa38xjz/4/