HTML Learning Notes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.