Html input and output

HTML Tag

Perform a calculation and show the result in an element:

Definition and Usage

The tag is used to represent the result of a calculation (like one performed by a script).

Browser Support

The numbers in the table specify the first browser version that fully supports the element.

Element
10.0 13.0 4.0 5.1 11.0

Attributes

Attribute Value Description
for element_id Specifies the relationship between the result of the calculation, and the elements used in the calculation
form form_id Specifies which form the output element belongs to
name name Specifies a name for the output element

Global Attributes

Event Attributes

Default CSS Settings

Most browsers will display the element with the following default values:

Unlock Full Access 50% off

COLOR PICKER

colorpicker

Join our Bootcamp!

Report Error

If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:

Thank You For Helping Us!

Your message has been sent to W3Schools.

Top Tutorials
Top References
Top Examples
Get Certified

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Источник

Html input and output

Элемент для вывода результатов вычислений или действий пользователя.

Время чтения: меньше 5 мин

Обновлено 24 августа 2022

Кратко

Скопировать ссылку «Кратко» Скопировано

Тег позволяет выводить результаты вычислений или действий пользователя. Относится к элементам семантической вёрстки.

Пример

Скопировать ссылку «Пример» Скопировано

   

Для скольких людей надо приготовить яичницу:

Необходимое количество яиц:

form> p>Для скольких людей надо приготовить яичницу:p> input type="number" name="peoples" oninput="eggs.value = (parseInt(peoples.value) * 2)"> p>Необходимое количество яиц:p> output name="eggs">output> form>

Как понять

Скопировать ссылку «Как понять» Скопировано

Элемент используется в тех случаях, когда пользователю надо показать результат работы программы в реальном времени, например:

  • информация, которую пользователь вводит или изменяет в форме;
  • вывод расчётов по данным, которые указал пользователь (калькулятор, гороскоп и тому подобное).

Как пишется

Скопировать ссылку «Как пишется» Скопировано

Тег парный. Допустимо вставлять пустой тег в разметку и класть выводимое значение внутрь него при помощи JavaScript.

Источник

HTML Form Elements

This chapter describes all the different HTML form elements.

The HTML Elements

The HTML element can contain one or more of the following form elements:

The Element

One of the most used form element is the element.

The element can be displayed in several ways, depending on the type attribute.

Example

All the different values of the type attribute are covered in the next chapter: HTML Input Types.

The Element

The element defines a label for several form elements.

The element is useful for screen-reader users, because the screen-reader will read out loud the label when the user focus on the input element.

The element also help users who have difficulty clicking on very small regions (such as radio buttons or checkboxes) — because when the user clicks the text within the element, it toggles the radio button/checkbox.

The for attribute of the tag should be equal to the id attribute of the element to bind them together.

The Element

The element defines a drop-down list:

Example

The elements defines an option that can be selected.

By default, the first item in the drop-down list is selected.

To define a pre-selected option, add the selected attribute to the option:

Example

Visible Values:

Use the size attribute to specify the number of visible values:

Example

Allow Multiple Selections:

Use the multiple attribute to allow the user to select more than one value:

Example

The Element

The element defines a multi-line input field (a text area):

Example

The rows attribute specifies the visible number of lines in a text area.

The cols attribute specifies the visible width of a text area.

This is how the HTML code above will be displayed in a browser:

You can also define the size of the text area by using CSS:

Example

The Element

The element defines a clickable button:

Example

This is how the HTML code above will be displayed in a browser:

Note: Always specify the type attribute for the button element. Different browsers may use different default types for the button element.

The and Elements

The element is used to group related data in a form.

The element defines a caption for the element.

Example

This is how the HTML code above will be displayed in a browser:

The Element

The element specifies a list of pre-defined options for an element.

Users will see a drop-down list of the pre-defined options as they input data.

The list attribute of the element, must refer to the id attribute of the element.

Example

The Element

The element represents the result of a calculation (like one performed by a script).

Example

Perform a calculation and show the result in an element:

HTML Exercises

HTML Form Elements

Tag Description
Defines an HTML form for user input
Defines an input control
Defines a multiline input control (text area)
Defines a label for an element
Groups related elements in a form
Defines a caption for a element
Defines a drop-down list
Defines a group of related options in a drop-down list
Defines an option in a drop-down list
Defines a clickable button
Specifies a list of pre-defined options for input controls
Defines the result of a calculation

For a complete list of all available HTML tags, visit our HTML Tag Reference.

Источник

: Элемент вывода

HTML-элемент вывода ( ) является контейнерным элементом, в котором сайт или приложение могут выводить результаты вычислений или действий пользователя.

Категории контента Потоковый контент, фразовый контент, перечисляемые, лэйбловые, сбрасываемые форма-ассоциированные элементы, явный контент.
Допустимый контент Фразовый контент.
Пропуск тегов Нет, открывающий и закрывающий теги обязательны.
Допустимые родители Все элементы, которые принимают фразовый контент.
Допустимые ARIA-роли Любые
DOM-интерфейс HTMLOutputElement (en-US)

Атрибуты

Пробело-разделяемый список id других элементов, указывающий, что эти элементы предоставили входные значения для (или иным образом повлияли) вычисления.

Имя элемента; используется для идентификации этого при отправке формы.

Пример

form oninput="result.value=parseInt(a.value)+parseInt(b.value)"> input type="range" name="b" value="50" /> + input type="number" name="a" value="10" /> = output name="result">60output> form> 

Спецификации

Поддержка браузерами

BCD tables only load in the browser

Смотрите также

Found a content problem with this page?

This page was last modified on 17 июл. 2023 г. by MDN contributors.

Your blueprint for a better internet.

MDN

Support

Our communities

Developers

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998– 2023 by individual mozilla.org contributors. Content available under a Creative Commons license.

Источник

Читайте также:  Mod php for windows
Оцените статью