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

<tfoot id='vcisA'></tfoot>
        <bdo id='vcisA'></bdo><ul id='vcisA'></ul>
    1. <i id='vcisA'><tr id='vcisA'><dt id='vcisA'><q id='vcisA'><span id='vcisA'><b id='vcisA'><form id='vcisA'><ins id='vcisA'></ins><ul id='vcisA'></ul><sub id='vcisA'></sub></form><legend id='vcisA'></legend><bdo id='vcisA'><pre id='vcisA'><center id='vcisA'></center></pre></bdo></b><th id='vcisA'></th></span></q></dt></tr></i><div id='vcisA'><tfoot id='vcisA'></tfoot><dl id='vcisA'><fieldset id='vcisA'></fieldset></dl></div>
    2. <legend id='vcisA'><style id='vcisA'><dir id='vcisA'><q id='vcisA'></q></dir></style></legend>
      1. 来自 JavaScript *without* &lt;input&gt; 的文件对话

        时间:2023-09-04
            <bdo id='zOf30'></bdo><ul id='zOf30'></ul>

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

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

            1. <tfoot id='zOf30'></tfoot>
            2. <legend id='zOf30'><style id='zOf30'><dir id='zOf30'><q id='zOf30'></q></dir></style></legend>

                  <tbody id='zOf30'></tbody>

                  本文介绍了来自 JavaScript *without* &lt;input&gt; 的文件对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在向现有页面添加文件导入功能.

                  I am adding file import functionality to an existing page.

                  我想使用 javascript 并且不修改页面来执行此操作,即.不加input type="file""标签,大家好像都在议论纷纷.

                  I want to do this using javascript and without modifying the page, ie. without adding the "input type="file" " tag, everyone seems to be talking about.

                  我已经添加了按钮,现在我希望事件显示文件对话框,用户浏览文件和 javascript 提交文件到服务器进行验证.

                  I have added the button, now I want the event to show the file dialog, user to browse for file and javascript to submit file to server for validation.

                  我该怎么做?顺便说一句,主要优先级是打开文件对话框,所以不需要用户或提交部分,如果你不知道的话.

                  How do I do that? Btw, main priority is opening file dialog, so no need for user or submitting part, if you don't know it.

                  谢谢

                  推荐答案

                  好吧,如果我理解正确你想要什么,是这样的......

                  Well, if I understand correct what you want, is some like this...

                  <input type="button" value="Add File" onclick="document.getElementById('file').click()" />
                  <input type="file" id="file" style="display:none" />
                  

                  隐藏 file 对象并使用另一个对象调用文件对话框.对吧?

                  Hidding the file object and calling the file dialog with another object. Right ?

                  仅 Javascript

                  myClickHandler() {
                      var f = document.createElement('input');
                      f.style.display='none';
                      f.type='file';
                      f.name='file';
                      document.getElementById('yourformhere').appendChild(f);
                      f.click();
                  }
                  
                  button.onclick = myClickHandler
                  

                  formid 代替 yourformhere 将其放入对象中!!

                  Put this in your object with the id of your form in place of yourformhere !!

                  这篇关于来自 JavaScript *without* &lt;input&gt; 的文件对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:将部分视图加载到 JQuery 对话框中的缓存问题 下一篇:JavaScript 确认取消按钮不停止 JavaScript

                  相关文章

                  最新文章

                • <small id='QhvOG'></small><noframes id='QhvOG'>

                    <bdo id='QhvOG'></bdo><ul id='QhvOG'></ul>

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

                    <tfoot id='QhvOG'></tfoot>

                      <legend id='QhvOG'><style id='QhvOG'><dir id='QhvOG'><q id='QhvOG'></q></dir></style></legend>