HTML interaction

不言
Release: 2018-04-24 10:05:47
Original
4516 people have browsed it

The content of this article is about the interaction of HTML, which has certain reference value. Now I share it with everyone. Friends in need can refer to it

1. How does the website interact with users? The answer is to use HTML forms. The form can transmit the data entered by the viewer to the server, so that the server-side program can process the data passed by the form.




1).: tags appear in pairs, starting with Start with
.


2).action: The place where the data entered by the viewer is sent, such as a PHP page (save.php).


3).method: The method of data transmission (get/post).


Example: method="post" action="save.php"




2. When the user wants to type letters and numbers in the form When waiting for content, the text input box will be used. The text box can also be converted into a password input box.

<form>
   <input type="text/password" name="名称" value="文本" />
</form>
Copy after login

1)type:


When type="text", the input box is a text input box;


When type= When "password" is used, the input box is the password input box.


2) name: Name the text box for use by the background programs ASP and PHP.


3)value: Set the default value for the text input box. (Generally used as a prompt)
Example:



3. When the user needs to enter a large section of text in the form, a text input field needs to be used.

<textarea  rows="行数" cols="列数">文本</textarea>
Copy after login


1).


2)cols: The number of columns in the multi-line input field.


3)rows: The number of rows in the multi-line input field.


4) Default values ​​can be entered between the tags.


Example:

<textarea cols="50" rows="10">在这里输入内容...</textarea>
Copy after login

4. Use radio buttons and check boxes to let users choose

<input   type="radio/checkbox"   value="值"    name="名称"   checked="checked"/>
Copy after login

1)type:


When type="radio", the control is a radio button


When type="checkbox", the control is a check box


2 )value: The value of submitting data to the server (used by background program PHP)


3) name: Name the control for use by background programs ASP and PHP


4 )checked: When setting checked="checked", this option is selected by default


For radio buttons in the same group, the name value must be consistent, and the value can be inconsistent. For example, the above example has the same name. "radioLove", so that the radio buttons in the same group can play the role of radio selection


5. Use the drop-down list box to save space

<option value="提交值">选项</option>  设置selected="selected"属性,则该选项就被默认选中。
Copy after login


6. The drop-down list can also perform multiple selection operations. Set the multiple="multiple" attribute in the