HTML表单标签中的target属性有什么用处? [英] What is the use of target attribute in HTML form tag?

查看:384
本文介绍了HTML表单标签中的target属性有什么用处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在PHP中实现文件上传进度条时,我在 form 标签中看到了这个目标属性。代码如下所示:

 < form action =<?php echo $ _SERVER [PHP_SELF];? >中
method =POSTid =myForm
enctype =multipart / form-data
target =hidden_​​iframe>

这个目标属性的用途实际上,在提交此表单数据(文件)后,我们会跟踪另一个页面上传进度,例如 upload.php 。我们可以在没有target属性的情况下实现这个吗?

解决方案

用于指定在哪个窗口中显示响应远程服务器提交您的表单。



可能的值包括:


  • _blank - 新页面

  • 框架 - 在给定名称的iframe中显示

  • _self - 在窗体所在的同一个iframe中显示

  • _parent - 在表单的iframe的父页/ iframe中显示

  • _top - 最上方的窗口

While I was implementing a file upload progress bar in PHP, I saw this target attribute in form tag. The code was like this:

<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" 
      method="POST" id="myForm" 
      enctype="multipart/form-data" 
      target="hidden_iframe">

What is the use of this target attribute here?

Actually, after submitting this form data (file) we track the upload progress from another page say upload.php. Could we implement this without the target attribute?

解决方案

That is used to specify in which window you would like to show the response from the remote server upon submitting your form.

Possible values are :

  • _blank - new page
  • frame - show in the iframe with the given name
  • _self - show in the same iframe where the form locates
  • _parent - show in the parent page/iframe of the form's iframe
  • _top - the top most window

这篇关于HTML表单标签中的target属性有什么用处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆