input object
An <input> tag is an input object.
Input object attributes (take type=text as an example)
name: The name of the form element.
value: The value of the form element, the content input by the user, can be obtained through this attribute.
size: The length of the form.
maxlength: The maximum length of the form element (the maximum number of characters that can be entered).
disabled: Disabled attribute.
readonly: Read-only attribute.
Input object method
focus(): Method to obtain focus (positioning the cursor).
blur(): Method to lose focus (remove cursor).
select(): Method for selecting text.
Input object events
onfocus: When focus is gained
onblur: When focus is lost
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8" /> <title>php.cn</title> <script> </script> </head> <body> <form name="form1" method="post" action="login.php"> 用户名:<input type="text" name="username" onfocus="this.value='focus';this.select()" onblur="this.value='blur'" /> 密码:<input type="password" name="userpwd" /> <input type="submit" value="提交表单" /> </form> </body> </html>Next Section