Home > Article > Web Front-end > What is the difference between the two ways of defining a button? _html/css_WEB-ITnose
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Insert title here</title></head><body> 通过层次关系获取节点.. <!-- 方式1 --> <button value="层次关系获取节点练习.." onclick="getNodeDemo">FUCK</button> <!-- 方式2 --> <input type="button" value="层次关系获取节点" onclick="getNodeDemo"/></body></html>
Use it however you want without doctype declaration. If there is a doctype, use input type=button
In fact, the code you write is also very clear. button is a label pair, and input type=button is an independent label
, which means that button can have child elements. For example, a picture a1f02c36ba31691bcfe87b2722de723b, and the input button can only use input type=image
For details, please see
http://www.w3.org/TR/html4/interact/forms.html #edef-BUTTON
Indeed, the correct answer is upstairs