JavaScript Base 20--element Object

Source: Internet
Author: User

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4         <MetaCharSet= "Utf-8">5         <title>Element Object</title>6         <Scripttype= "Text/javascript">7             //Element Object8             /*9 Get property: GetAttribute (name)Ten Set properties: SetAttribute (name, value) One Delete attribute: removeattribute (name) A             */ -         </Script> -     </Head> the     <Body> -         <!--<input type= "text" id= "Textid" value= " textcontent"/> - -         <ul> -             <Li>Aaa</Li> +             <Li>Bbb</Li> -             <Li>Ccc</Li> +         </ul> A         <Scripttype= "Text/javascript"> at             //Get Input Label -             //var input = document.getElementById ("Textid"); -             //Get value Values -             //document.write (Input.getattribute ("value")); -             //Get ID value, use method to get class value can avoid keyword conflict -             //document.write (Input.getattribute ("id")); in             //Setting Value property values -             //Input.setattribute ("value", "newcontent"); to             //Delete id attribute, cannot delete Value property +             //document.write ("<br/> Original value:" + input.id); -             //Input.removeattribute ("id"); the             //document.write ("<br/> After deletion:" + input.id); *             varul=document.getElementsByTagName ("ul")[0]; $             //the ChildNodes property has poor browser compatibility, so use the getElementsByTagName () methodPanax Notoginseng             varLis=Ul.getelementsbytagname ("Li"); - document.write (lis.length); the         </Script> +     </Body> A </HTML>

JavaScript Base 20--element Object

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.