Html5<input> Placeholder Properties
Instance search field with placeholder text:
1 <formAction= "Demo_form.asp"Method= "Get">2 <inputtype= "Search"name= "User_search"placeholder= "Serarch w3school"/>3 <inputtype= "Submit"/>4 </form>
Definition and usage
The Palaceholder property provides a hint that describes the expected value of an input field.
The hint appears when the input field is empty and disappears when the field gets focus.
Note: The placeholder property applies to the following <input> types: Text,search,url,telephone,email and password.
Syntax: <input placeholder= "Text" >
HTML OnLoad Event Properties
<!DOCTYPE HTML><HTML> <Head> <Script> functionload () {alert ("The page is loaded!") } </Script> </Head> <Bodyonload= "load ()"> <H1>Hello world!</H1> </Body></HTML>
Instance: Executes a section of Javascript;<body immediately after the page loads onload= "load ()" >
Definition and usage
The OnLoad property is triggered when an object is loaded.
OnLoad is commonly used in <body>, and once all content is fully loaded (including images, script files, CSS files, etc.), a script is executed.
HTML onblur Event Properties
Instance: Validates a user when they leave the input field:
<input type= "text" name= "fname" id= "fname" onblur= "uppercase ()" >
Definition and usage
The Onblur property is triggered when the element loses focus.
Onblur is often used for form validation code (for example, when a user leaves a form field)
Tip: The Onblur property is the opposite of the Onfocus property
<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "UTF-8"> <title></title> <Script> functionuppercase () {varx=document.getElementById ("fname"). Value document.getElementById ("fname"). Value=x.touppercase ()}</Script> </Head> <Body> <P>Please enter your name and move the focus to the outside of the field:</P>Please enter your name (English character):<inputtype= "text"name= "FName"ID= "FName"onblur= "uppercase ()"/> </Body></HTML>
HTML Learning Notes