您的位置:首页 > Web前端 > HTML

接口返回html形式_HTML形式

2020-08-03 00:56 1506 查看

接口返回html形式

HTML表格 (HTML Forms)

A form is a page that is used to get some data input from the user. For example, for registration, login, feedback, etc. forms are very useful.

表单是一个页面,用于从用户那里获取一些数据输入。 例如,对于注册,登录,反馈等表格非常有用。

In HTML too, forms are used for the same purpose, it's just that the user is a visitor of the website. Forms in HTML is a collection of different types of input tags along with indications for the user on what to fill in it.

在HTML中, 表单也用于相同的目的,只是用户是网站的访问者。 HTML中的表单是不同类型的输入标签的集合,同时还向用户提供有关填写内容的指示。

The data collected is tracked by the backend programming languages (like PHP, ASP, etc) to process it.

后端编程语言(例如PHPASP等)会跟踪收集到的数据以进行处理。

The form in HTML is created using <form> tag.

HTML中的表单是使用<form>标记创建的。

Syntax:

句法:

<form>
...
</form>
[/code]

All the elements are to be enclosed inside this tag only.

所有元素只能包含在此标记内。

In a form, there are two main parts, the text that makes up the form and the type of input that is used to get input from the user.

在表单中,有两个主要部分,即构成表单的文本和用于从用户获取输入的输入类型。

The text is simply HTML tags like <h1>, <p>, etc that are used to print text in HTML.

文本只是用于在HTML中打印文本HTML标签,例如<h1> , <p>等。

HTML输入 (HTML Input)

There are multiple types of inputs that are valid and can be used in HTML to get data from the user in the HTML Form. They are,

有效的输入有多种类型,可以在HTML中使用这些输入以HTML表单的形式从用户获取数据。 他们是,

  • Text input: used to get input in basic text format.

    文字输入 :用于获取基本文字格式的输入。

  • Radio Button: used to get a radio button (select one out of multiple-choice).

    单选按钮 :用于获取单选按钮(从多项选择中选择一个)。

  • Checkbox: used to get a multi-select option button.

    复选框 :用于获取多选选项按钮。

  • Select Box: used to get a dropdown list of options forms users to select.

    选择框 :用于获取用户要选择的选项表单的下拉列表。

  • File upload: used to place a file upload input box.

    文件上传 :用于放置文件上传输入框。

  • Button: used to get a button in the form. The most common is the submit button.

    Button :用于获取表单中的按钮。 最常见的是提交按钮。

动作属性 (Action Attribute)

The action attribute of the HTML form is used to call the page (code) that will act on the particular form. Normally a server-side script is called for acting.

HTML表单的action属性用于调用将作用于特定表单的页面(代码)。 通常,调用服务器端脚本来执行。

Syntax:

句法:

<form action="Action.php">
[/code]

目标属性 (Target Attribute)

The target attribute of the HTML form is used to define the page to which the page will be opened on submitting the form.

HTML表单的target属性用于定义提交表单时将打开该页面的页面。

The default value of the target attribute is _self.

target属性的默认值为_self 。

Syntax:

句法:

<form action="action.php" target="_blank">
[/code]

It will open a new tab to display the result of form submission.

它将打开一个新选项卡以显示表单提交的结果。

方法属性 (Method Attribute)

The method attribute in HTML forms is used to define the HTTP method which is to be used for submitting the form.

HTML表单中的method属性用于定义将用于提交表单的HTTP方法。

Syntax:

句法:

<form action="action.php" method="get">
[/code]

In HTML there are two methods that are used,

在HTML中,使用了两种方法:

  • get

    得到

  • post

    发布

get: get is a method used to submit data to the webserver from HTML forms. In get method, the data which is submitted to the server can be seen in the browser's address bar. Also, the length of data that can be transmitted by the get method is 2048 characters.

getget是用于从HTML表单向Web服务器提交数据的方法。 在get方法中,可以在浏览器的地址栏中看到提交给服务器的数据。 另外,可以通过get方法传输的数据长度为2048个字符。

post: post method is used to submit data to the webserver from the HTML form. In post method, the data submitted is secure and cannot be seen in the address bar.

postpost方法用于从HTML表单向Web服务器提交数据。 在发布方式中,提交的数据是安全的,并且无法在地址栏中看到。

Example: A simple HTML login form

示例:一个简单HTML登录表单

<!DOCTYPE html>

<html>

<body>
<h2>HTML Forms</h2>
<form action="/action_page.php" target="_blank" method="post">
<p>UserName or Mobile No. :
<input type="text">
</p>
<p>Password :
<input type="password">
</p>
<input type="submit" value="Submit">
</form>
</body>

</html>
[/code]

Output

输出量

翻译自: https://www.includehelp.com/html/forms.aspx

接口返回html形式

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: