简体   繁体   English

我们可以通过单击 html 的浏览打开按钮来调用 javascript function 吗?

[英]can we call a javascript function by clicking open button of browse of html?

Hi guys actually I want to call a function by clicking on open button of browse field of HTML.Is it possible,if yes then provide me information嗨,伙计们,实际上我想通过单击 HTML 浏览字段的打开按钮来调用 function。是否可能,如果是,请提供信息

No. The "Browse" button is not accessible via JS (neither is just the text field next to it).不可以。“浏览”按钮不能通过 JS 访问(也不是它旁边的文本字段)。

File uploads fields are very restricted not only regarding JS access - you cannot even style them properly.文件上传字段不仅在 JS 访问方面受到严格限制——您甚至无法正确设置它们的样式。

Basically there is restriction on browse button, but there is a solution by "onchange" event to call another js function.基本上浏览按钮有限制,但是有一个解决方案是通过“onchange”事件调用另一个js function。 And you can do as you want, eg: gmail file upload attachment, and shows all uploaded files and you can deselect each of them, so these type of js operation can be perform by OnChange method.....而且你可以做你想做的,例如:gmail文件上传附件,并显示所有上传的文件,你可以取消选择每个,所以这些类型的js操作可以通过OnChange方法进行......

and there is a lot of example to do work with browse button.并且有很多示例可以使用浏览按钮。 altering on type=file 改变类型=文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 want to create a javascript function which on clicking button call php function which create a select option - want to create a javascript function which on clicking button call php function which create a select option 通过单击html按钮访问PHP函数 - Acces PHP function with clicking an html-button 在PHP代码中单击链接javascript函数调用 - In PHP code on clicking a link javascript function call 使用浏览按钮打开特定文件 - Open a specific file using Browse button PHP / html Web应用程序浏览和打开文件 - PHP / html web app to browse and open files 我们可以通过在 php 中使用 mailto 函数来隐藏按钮并检查邮件是否已发送来获得回电吗? - can we get a call back by using mailto function in php to hide the button and check mail has been sent? 在php / javascript中打开/浏览对话框? - Open/Browse Dialog box in php/javascript? 通过单击按钮从javascript和php调用两个函数 - Call two functions from javascript and php by clicking button 如何通过单击按钮来调用JavaScript函数并在循环的文本框中执行操作? - How to Call JavaScript functions by clicking a button and perform operations in looped textboxes? PHP 文件和 Javascript function 未捕获 Z3135F4019BEE015E2D1AE7Fid 提交到 ZF div3 后隐藏 div34 - PHP file and Javascript function doesn't capture Html div id to show hidden div after clicking submit button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM