字幕列表 影片播放 列印英文字幕 Forms allow users to enter and submit data. For example, we can use forms to handle logins, order forms, and user feedback. The form tag requires two attributes - action and method. Action is the location where the form is sent to. This can be either an email link or a form handling script. A from handler requires server-side programming and uses the Common Gateway Interface (CGI), both of which will be covered in different tutorials. The other required attribute is the sending method, which can be either GET or POST. GET sends the form data directly when it calls the form handler by appending the data to the URL. POST, on the other hand, sends the data to the handler in a separate transmission. Which method we should use may depend on the form handler. Inside of the form tag we may place any elements we want, but most importantly we may here include the form controls. Most controls uses the <input> element which lets us create buttons, text fields, and alternatives. Almost every form control requires a name and a value to either be specified in the markup or entered by the user. These name value pairs are what is later sent to the form handler. Every form needs a submit button which send the form to the handler. We can also add a reset button for resetting the form to its initial values. The default text label can be changed using the value attribute. Additionally, we can add custom, normal, or image buttons. However, to give them any functionality requires the use of a scripting language such as JavaScript, which will be covered in a different tutorial. Another way to make custom buttons is using the <button> element, which gives more control over how the button is displayed. Finally, the file input type is used to allow the user to select a file on their computer.
B1 中級 HTML教程-13-表格I (HTML Tutorial - 13 - Forms I) 14 4 Pan-Shy Gang 發佈於 2021 年 01 月 14 日 更多分享 分享 收藏 回報 影片單字