Javascript-document Object Properties and methods

Source: Internet
Author: User

Properties and methods for document objects
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" ><html>  <head>    <title>Test10.html</title>    <script type="Text/javascript">        //document Properties of an object        /*alert (Document.referrer); Alert (document. URL); * /        Methods for//document objects         function change(){            varobjspan=$ ("Heihei"); Objspan.innerhtml="Summer Class"; } function getallhobbies(){            varHobbies=document.getelementsbyname ("Hobby"); for(varI=0; i"MSG"). innerhtml+=hobbies[i].value+" "}        } function getallinputs(){            varInputs=document.getelementsbytagname ("Input"); for(varI=0; i<inputs.length;i++) {document.getElementById ("MSG"). innerhtml+=inputs[i].value+" "}        }//Factory function to simply get the element with the specified ID         function $(ID){            returndocument.getElementById (ID); }</script>  </head>  <body>    <a href="javascript:location.href= ' test01.html '">test01</a><br/>    <input type="button" value="Flush" onclick=" Location.reload (); " /><br/>    <input type="button" value="forward" onclick ="History.go (1)"/><br/>    <input type="button" value="Back" onclick=" History.back (); " /><br/>    <span id="Heihei">wbs14061</span><input type="button" value="variable" onclick="Change () " /> <br/>   <h4>Please choose your hobby:</h4>   <input type="checkbox" name="Hobby" value ="Game" />Play games &nbsp;&nbsp;<input type="checkbox" name= "hobby" value="movie " />Watch movies &nbsp;&nbsp;<input type="checkbox" name="Hobby" value= "Sport" />Sports &nbsp;&nbsp;<input type="checkbox" name= "hobby" value="Eat" />Dining &nbsp;&nbsp;<input type="button" value="Get all Hobbies" onclick ="Getallhobbies ()" /><br/><br/>   <input type="button" value="Get all input elements" onclick= "getallinputs ()" />   <hr/>   <div id="msg"></div>  </body></html>

Javascript-document Object Properties and methods

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.