简体   繁体   English

HTML5中type属性的用法

[英]Usage of type attribute in HTML5

  <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>

In the above code , they have used type="submit" . 在上面的代码中,他们使用了type =“ submit”。 Is this "submit" a predefined one or it can be anything. 这个“提交”是预定义的,还是可以是任何东西。 Can I also use type="pradeeba" (user defined attribute). 我也可以使用type =“ pradeeba”(用户定义的属性)。

And second query is on value attribute. 第二个查询是关于value属性。 For certain tags i could find that value is mentioned whereas in certain places value is not metioned. 对于某些标签,我可以发现该值被提及,而在某些地方未提及值。 Is value a mandatory attribut for every input type. 值是每种输入类型的强制属性吗?

Pls help on the two queries. 请帮助两个查询。

submit is a predefined type. submit是预定义的类型。

Per the W3C http://dev.w3.org/html5/markup/input.html : 根据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" will render as a type="text" element in all browsers I'm aware of. 在我知道的所有浏览器中, type="pradeeba"将呈现为type="text"元素。

Value attribute specifies the initial value of the control. 值属性指定控件的初始值。 It is optional. 它是可选的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM