1 <HTML> 2 <Head>3 <MetaCharSet= "Utf-8">4 <title>Method of Document Object</title>5 </Head>6 <Body>7 <DivID= "divID"></Div>8 <!-- 9 1. WriteTen Note the method that belongs to the document, not the element label One - A <Scriptlanguage= "JavaScript"> - document.write ("Hello World"); - document.write ("Hello world<br/>"); the </Script> - <!-- - 2, Writein difference: one more space - - + <Scriptlanguage= "JavaScript"> - Document.writeln ("Writein"); + Document.writeln ("Writein"); A Document.writeln ("Writein"); at Document.writeln ("Writein"); - document.close (); - </Script> - <!-- - 3, open Document.open () and window.open () the same effect - recommended use of window.open () in - - <Scriptlanguage= "JavaScript"> to Document.open ("","_blank"); + //window.open ("http://www.baidu.com", "_blank"); - </Script> the <!-- * 4, close after all the content has been written to the newly opened document flow, $ Be sure to call this method to close the document flow,Panax Notoginseng Otherwise, there may be some indeterminate results - imagine the IO stream shutting down every time . the - + <Scriptlanguage= "JavaScript"> A //document.close (); the </Script> + <!-- - 5. Clear () Clears all content in the document $ has not been fully supported, $ You can use the write (), close () two statement instead - - - <Scriptlanguage= "JavaScript"> the document.clear (); - </Script>Wuyi <!-- the 6, getElementById ("Id") - cannot have two elements with the same id attribute value Wu - - <!-- About 7, Getelementsbyname ("") $ returned is an array of - - - <!-- - 8, getElementsByTagName ("") A returns all of the label names equal to the specified parameters + an array of objects corresponding to the HTML element the - - <!-- $ 9, document.createelement ("option") the produces an object that represents an HTML element the - the <!-- the 10, createStyleSheet - It is recommended that you use obj. Classname= "DIV"; in - the <!-- the 11. About - the </Body> the </HTML>
Methods for Dhtml_____document objects