<input type = "button"> Creating ControlsYou use the <input> element to create controls such as buttons and text fields. Setting the type attribute indicates what kind of control you want to create, and this element supports different attributes based on control type. This element is empty and is supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1. Here are the attributes for <input type="button"> :
This element supports these XHTML events: onclick , ondblclick , onmousedown , onmouseup , onmouseover , onmousemove , onmouseout , onkeypress , onkeydown , onkeyup , onfocus , onblur , onselect , and onchange . You can create buttons in XHTML with the <input type="button"> element (and also with the <button> element). We saw an example in the previous topic: <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> Using Forms in XHTML </title> <script language = "javascript"> function displayMessage() { document.form1.textfield.value = "Hello from JavaScript." } </script> </head> <body> <center> <h1> Using Forms in XHTML </h1> <form name = "form1" id = "form1" action = "action"> <input type = "text" name = "textfield" size = "25" /> <br /> <br /> <input type = "button" value = "Click Me" onclick = "displayMessage()" /> </form> </center> </body> </html> You can create plenty of other controls, of course. I'll take a brief look at creating text fields next . |