<tfoot id='wxIpd'></tfoot>

  • <legend id='wxIpd'><style id='wxIpd'><dir id='wxIpd'><q id='wxIpd'></q></dir></style></legend>

    • <bdo id='wxIpd'></bdo><ul id='wxIpd'></ul>
      <i id='wxIpd'><tr id='wxIpd'><dt id='wxIpd'><q id='wxIpd'><span id='wxIpd'><b id='wxIpd'><form id='wxIpd'><ins id='wxIpd'></ins><ul id='wxIpd'></ul><sub id='wxIpd'></sub></form><legend id='wxIpd'></legend><bdo id='wxIpd'><pre id='wxIpd'><center id='wxIpd'></center></pre></bdo></b><th id='wxIpd'></th></span></q></dt></tr></i><div id='wxIpd'><tfoot id='wxIpd'></tfoot><dl id='wxIpd'><fieldset id='wxIpd'></fieldset></dl></div>
    1. <small id='wxIpd'></small><noframes id='wxIpd'>

        Javascript 数组警报

        Javascript Array Alert(Javascript 数组警报)
        <tfoot id='gB69R'></tfoot>
          • <bdo id='gB69R'></bdo><ul id='gB69R'></ul>
                <tbody id='gB69R'></tbody>
              <legend id='gB69R'><style id='gB69R'><dir id='gB69R'><q id='gB69R'></q></dir></style></legend>

              <small id='gB69R'></small><noframes id='gB69R'>

              <i id='gB69R'><tr id='gB69R'><dt id='gB69R'><q id='gB69R'><span id='gB69R'><b id='gB69R'><form id='gB69R'><ins id='gB69R'></ins><ul id='gB69R'></ul><sub id='gB69R'></sub></form><legend id='gB69R'></legend><bdo id='gB69R'><pre id='gB69R'><center id='gB69R'></center></pre></bdo></b><th id='gB69R'></th></span></q></dt></tr></i><div id='gB69R'><tfoot id='gB69R'></tfoot><dl id='gB69R'><fieldset id='gB69R'></fieldset></dl></div>

                  本文介绍了Javascript 数组警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是 Javascript 新手.

                  Im new to Javascript.

                  我正在尝试编写这四个按钮.我目前在做第二个.我编写了一个数组.但是当我点击按钮时,它会替换页面.我想在警告框中显示数组.

                  Im trying to code these four buttons. I'm currently on the second one. I've coded an array. But when I click on the button, it replaces the page. I want to display the array in an alert box.

                  <html>
                  <head>
                  <script type="text/javascript">
                  
                  function SayHello()
                  {
                      alert("Hello World!");
                  }
                  
                  function DumpCustomers()
                  {
                  
                      var aCustomers=new Array();
                      aCustomers[0]="Frank Sinatra ";
                      aCustomers[1]="Bob Villa ";
                      aCustomers[2]="Kurt Cobain ";
                      aCustomers[3]="Tom Cruise ";
                      aCustomers[4]="Tim Robbins ";
                      aCustomers[5]="Santa Claus ";
                      aCustomers[6]="Easter Bunny ";
                      aCustomers[7]="Clark Kent ";
                      aCustomers[8]="Marry Poppins ";
                      aCustomers[9]="John Wayne ";
                  
                      document.write(aCustomers[0]);
                      document.write(aCustomers[1]);
                      document.write(aCustomers[2]);
                      document.write(aCustomers[3]);
                      document.write(aCustomers[4]);
                      document.write(aCustomers[5]);
                      document.write(aCustomers[6]);
                      document.write(aCustomers[7]);
                      document.write(aCustomers[8]);
                      document.write(aCustomers[9]);
                  }
                  
                  function DisplayFishCounts()
                  {
                  
                  }
                  function FindJonGalt()
                  {
                  
                  }
                  
                  </script>
                  </head>
                  
                  <body>
                  <form name="Main">
                  <input type="button" id=1 onclick="SayHello();" value="Say Hi"/>
                  <input type="button" id=1 onclick="DumpCustomers();" value="Dump Customers"/>
                  <input type="button" id=1 onclick="DisplayFishCounts();" value="Display Fish Counts"/>
                  <input type="button" id=1 onclick="FindJonGalt();" value="Where is Jon Galt?"/>
                  
                  </form>
                  </body>
                  </html>
                  

                  推荐答案

                  如果想把数组看成数组,可以说

                  If you want to see the array as an array, you can say

                  alert(JSON.stringify(aCustomers));
                  

                  而不是所有那些 document.writes.

                  http://jsfiddle.net/5b2eb/

                  但是,如果您想在弹出窗口中清晰地显示它们,每行一个,请执行以下操作:

                  However, if you want to display them cleanly, one per line, in your popup, do this:

                  alert(aCustomers.join("
                  "));
                  

                  http://jsfiddle.net/5b2eb/1/

                  这篇关于Javascript 数组警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Fetch multiple links inside foreach loop(在 foreach 循环中获取多个链接)
                  Backbone Fetch Request is OPTIONS method(Backbone Fetch Request 是 OPTIONS 方法)
                  Fetch API leaks memory in Chrome(Fetch API 在 Chrome 中泄漏内存)
                  How can I download and save a file using the Fetch API? (Node.js)(如何使用 Fetch API 下载和保存文件?(Node.js))
                  Send blob data to node using fetch, multer, express(使用 fetch、multer、express 将 blob 数据发送到节点)
                  Sending a custom User-Agent string along with my headers (fetch)(发送自定义用户代理字符串以及我的标头(获取))

                  <small id='4zN7A'></small><noframes id='4zN7A'>

                  <i id='4zN7A'><tr id='4zN7A'><dt id='4zN7A'><q id='4zN7A'><span id='4zN7A'><b id='4zN7A'><form id='4zN7A'><ins id='4zN7A'></ins><ul id='4zN7A'></ul><sub id='4zN7A'></sub></form><legend id='4zN7A'></legend><bdo id='4zN7A'><pre id='4zN7A'><center id='4zN7A'></center></pre></bdo></b><th id='4zN7A'></th></span></q></dt></tr></i><div id='4zN7A'><tfoot id='4zN7A'></tfoot><dl id='4zN7A'><fieldset id='4zN7A'></fieldset></dl></div>
                      • <bdo id='4zN7A'></bdo><ul id='4zN7A'></ul>

                        1. <tfoot id='4zN7A'></tfoot>
                            <tbody id='4zN7A'></tbody>
                          <legend id='4zN7A'><style id='4zN7A'><dir id='4zN7A'><q id='4zN7A'></q></dir></style></legend>