在HTML5中使用type属性

时间:2013-12-09 03:17:55

标签: html html5 forms

  <body>
    <form action="Welcome.html" method="get" id="user_id">
        <input type="submit" formmethod="post" value="post method submit"/> </br>
    <input type="submit" formtarget="_blank" value="opens in new window"/> </br>
    </form>
</body>
</html>

在上面的代码中,他们使用了type =“submit”。这是“提交”预定义的一个,还是可以是任何东西。我还可以使用type =“pradeeba”(用户定义的属性)。

第二个查询是关于value属性的。对于某些标签,我可以发现提到的值,而在某些地方,值没有被提及。值是每种输入类型的必需属性。

请帮助解决这两个问题。

2 个答案:

答案 0 :(得分:1)

submit是预定义类型。

根据W3C http://dev.w3.org/html5/markup/input.html

input type=text
input type=password
input type=checkbox
input type=radio
input type=button
input type=submit
input type=reset
input type=file
input type=hidden
input type=image
input type=datetime
input type=datetime-local
input type=date
input type=month
input type=time
input type=week
input type=number
input type=range
input type=email
input type=url
input type=search
input type=tel
input type=color

type="pradeeba"将在我知道的所有浏览器中呈现为type="text"元素。

答案 1 :(得分:-2)

Value属性指定控件的初始值。这是可选的。