Home  >  Article  >  Web Front-end  >  Form components in HTML

Form components in HTML

墨辰丷
墨辰丷Original
2018-06-04 14:35:151613browse

This article introduces you to the knowledge of HTML form components through example code. It is very good and has reference value. Friends who need it can refer to it

HTML forms are used to collect different types of user input.

The specific code is as follows:

<!DOCTYPE html>  
<html>  
<head>  
<meta charset="UTF-8">  
<title>Insert title here</title>  
</head>  
<body>  
    <!--  
    如果要给服务端提交数据 表单中的组件必须有name和value属性  
    用于给服务端获取数据   
     -->  
<from>输入名称:<input type="text" name="user" value=""/><br/>  
        输入密码:<input type="password" name="passwd" value=""/>  
        <br/>  
      选择性别:<input type="radio" name="sex" vlaue="nan"/> 男  <input type="radio" name="sex" value="nv" checked="checked"/> 女  
    <br/>  
    选择技术:  
        <input type="checkbox" name="tech" value="java"/>Java  
        <input type="checkbox" name="tech" value="html"/>html  
        <input type="checkbox" name="tech" value="css"/>CSS<br/>  
    选择文件:  
        <input type="file" name="file" /><br/>  
    一个图片:<input type="image" src="11.jpg" ><br/>  
    <!-- 数据不需要客户端指定 但是可以将其提交服务端 -->  
    隐藏组件:<input type="hidden" name="mykey" value="myvalue"/><br/>  
    一个按钮:<input type="button" value="有个按钮" onclick="alert(&#39;有个按钮&#39;)"><br/>  
    <select name="contry">  
        <option value="none">--选择国家-</option>  
        <option value="usa">美国</option>  
        <option value="en">英国</option>  
        <option value="cn" selected="selected">中国</option>  
    </select>  
    <textarea name="text"></textarea>  
    <br/>  
    <input type="reset" value="清除数据"/><input type="submit" value="提交数据"/>  
<from>  
</body>  
</html>

Summary: The above is the entire content of this article, I hope it can be helpful to everyone’s learning help.

Related recommendations:

PHP implements web contenthtmlMethods for tag completion and filtering

# #Based on ajax html Summary of file upload skills

How to introduce CSS into HTML

The above is the detailed content of Form components in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:html search box functionNext article:html search box function