<Button> Tag definition and usage <Button> The tag defines a button. Inside the element of the button, you can place the content, such as text or image. This is the element and USES the input element to create the difference between the button. <Button> Controls and <Inputtype=" Button" > Compared, provides a more powerful and richer content. <Button> With </button> Label all the content is the content of the button, including any acceptable body content, such as text or multimedia content. For example, we can include an image in button and related text, use them in the button to create a catchy tag images. Element is the only banned image map, because it is sensitive to the mouse and keyboard action may interfere with the form of the behavior of the button. Please always be button type attribute. InternetExplorer is the default type " Button" While other browsers (including the default value is the W3C specification) " Submit" . Browser support for all major browsers support <Button> The label. Important: if using the button in the HTML form elements, different browsers will submit different values. InternetExplorer will submit <Button> With <The button/> The text, while the other browsers will be submitted to the content of the value attribute. Please use the input element to create in the HTML form button. Matters needing attention in using <Button> Label as it is easy to take it for granted when <Inputtype=" Button" > Use, it is easy to produce the following error usage: 1, through the $(' # customBtn). Val () to obtain <Buttonid=" CustomBtn" value=http://www.jb51.net//web/" Test" > Button </button> Under the core value of the value in IE (Internet explorer) that is used to value is &other; Button &throughout; Instead, &other Test” , get is not under the IE &other; Test” . The first thing to marked red. This is and <Inputtype=" Button" > Separate. By these two approaches $(' # customBtn). Val () and $(' # customBtn). Attr (' value ') value in different browsers, as follows:

Browser/Value

$(' # customBtn). Val ()

$(' # customBtn). Attr (' value ')

Firefox13.0

test

test

Chrome15.0

test

test

Opera11.61

test

test

Safari5.1.4

test

test

IE9.0

button

button

Test can verify this in the following code to the

 


code is as follows:


<Html> <Head> <Metahttp - equiv="content-type" Content="text/HTML; charset=utf-8"/> <Scripttype="text/javascript 'SRC=" http://www.jb51.net//web/jquery-1.4.4.min.js "> </script> <Scripttype="text/javascript" > $(the function () {$(' # test1). Click (function () {alert ($(' # customBtn). Attr (" value "));}); $(' # test2). Click (function () {alert ($(' # customBtn). Val ());});}); </script> </head> <Body> <Buttonid="customBtn" value="http://www.jb51.net//web/test" > & # x6309; & # x94AE; </button> <Inputtype="button" id="test1" value="http://www.jb51.net//web/getattr"/> <Inputtype="button" id="test2" value="http://www.jb51.net//web/getval"/> </body> </html> 2, inadvertently put <Button> Label on the <Form> TAB, you will find that the click this button into submission, equivalent to <Inputtype=" Submit"/> This refer to the second sentence above red words to understand what you mean. Don't put <Button> Label as <Form> The input element. Test can verify this in the following code to the

 


code is as follows:


<Html> <Body> <Formaction binds="" > <Button> Button <Inputtype="submit" value="http://www.jb51.net//web/inputsubmit"/> <Inputtype="button" value="http://www.jb51.net//web/inputbutton"/> </form> </body> </html>


This concludes the body part