ThoughtWorks创新实验室

HTML之form表单

2016-11-28  本文已影响32人  落花的季节

什么是form表单?

用来接收用户输入信息,表单中可以包含input标签。

form表单的属性

<form method="post" action="http://codefordream.com/form">
     name:<input name="name" />
     <button>submit</button>
</form>
<form action="http://codefordream.com/form" accept-charset="gb2312">
<form action="index.html" method="get" autocomplete="on">
<form action="index.html" method="get" name="myform">
<form method="post" action="http://codefordream.com/form"> 
      <p> 
        <label>name: <input name="name" /></label> 
      </p> 
      <button>submit</button>
</form>

运行结果:


<form method="post" action="http://codefordream.com/form"> 
    <fieldset style="width: 300px;"> 
        <p> 
          <label for="name">name: <input id="name" name="name" /></label>  
        </p> 
        <p> 
          <label for="age">age: <input id="age" name="name" /></label>         
        </p> 
    </fieldset> 
    <fieldset style="width: 300px;"> 
        <p> 
          <label for="grade">grade: <input id="grade" name="name" /></label> 
        </p> 
     </fieldset> 
    <button>submit</button>
</form>

运行结果:


<form method="post" action="http://codefordream.com/form"> 
    <fieldset style="width: 300px;"> 
      <legend>进入个人信息</legend> 
        <p> 
          <label for="name">name: <input id="name" name="name" /></label> 
      </p> 
      <p> 
        <label for="age">age: <input id="age" name="name" /></label>       
      </p> 
     </fieldset> 
     <button>submit</button>
</form>

运行结果:


<fieldset disabled="disabled" >
上一篇下一篇

猜你喜欢

热点阅读