dtysql0586 2012-04-14 14:05
浏览 60
已采纳

表单到iframe提交 - 如何在文件上传后重置表单?

I have a form that submits the results to an iframe. The submitted fields and file upload are handled by upload.php. Everything works as expected creating an ajax style result although I want the form to reset after a successful file submission. Otherwise the submit button will keep uploading the same file.

form

<form action="functions/upload.php" method="POST" enctype="multipart/form-data" name="form1" id="form1" target="fileupload">

iframe

<iframe name="fileupload" frameborder="0" src="functions/upload.php" style="float:none; color:#FFF; display:none" width="100%" id="result" allowtransparency="true"></iframe> 
  • 写回答

1条回答 默认 最新

  • dongtuan1980 2012-04-14 14:09
    关注

    You can run the following JavaScript code inside the iframe right after the file has been successfully uploaded.

    parent.document.getElementById("form1").reset();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HC32L176调试了一个通过TIMER5+DMA驱动WS2812B
  • ¥15 三菱FX系列PLC串口指令
  • ¥15 cocos的js代码调用wx.createUseInfoButton问题!
  • ¥15 关于自相关函数法和周期图法实现对随机信号的功率谱估计的matlab程序运行的问题,请各位专家解答!
  • ¥15 Python程序,深度学习,有偿私
  • ¥15 扫描枪扫条形码出现问题
  • ¥35 poi合并多个word成一个新word,原word中横版没了.
  • ¥15 【火车头采集器】搜狐娱乐这种列表页网址,怎么采集?
  • ¥15 求MCSCANX 帮助
  • ¥15 机器学习训练相关模型