作者archon (内湖流川枫)
看板Web_Design
标题[问题] <input type="file" 的 onchange
时间Sun Aug 7 06:10:51 2016
各位大大好... <(_ _)>
在 Client 端想要做一个行为,
利用 <input type="file ... > 选档案後就自动 submit。
在网路上查到的资料都这麽说
<input type="file" onchange="this.form.submit();" ..... >
还有很多变型,像是用 jQuery 之类的...
大致上都一样,就是用 onchange,但我试了各种方式,
感觉我在选择档案的时候,那个 input 根本就没有 changed,
别说 submit() 了,我放 alert() 都没反应...
想请问各位大大,是不是我误解了什麽... QwQ
--
Would you be my heroine?
https://goo.gl/KbSK7y
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.45.204.150
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Web_Design/M.1470521455.A.071.html
1F:→ archon: 自问自答: 因为我底下的 submit button 的 name 命名问题 08/07 13:53
2F:→ archon: <input type="submit" name="submit" id="Upload" /> 08/07 13:53
3F:→ archon: name 不要取为 submit 就好了 QwQ 08/07 13:54
4F:推 kyleJ: 推自己解答 另外js要很小心撞名的问题 08/07 19:12
5F:→ kyleJ: 常常不小心就命名到不能使用的名字orz 08/07 19:13