DOM What can be done?
Learning process about to begin, I would first several practical examples to see what it can do DOM.
This section notes reference guide:
- Chinese: DOM How To
- English: DOM How To
Change the background pages
Course changes in the following section of the web page background color JavaScript code.
Function ChangeColor () (
Document.body.bgColor = "yellow"
)
In fact, in HTML DOM has been briefed on the inside we made a similar examples of the. Here, we do still more interesting example.
Hide and Show
JavaScript code:
<script Type="text/javascript" />
Function hide () (
Document.getElementById ( "hiddenTest"). Style.display = "none";
)
Function show () (
Document.getElementById ( "hiddenTest"). Style.display = "block";
)
</ Script>
HTML:
<form Action="#" /> <button onclick="hide(); return false;" value="Hidden" /> hidden paragraphs </ button> <button onclick = "show (); return false;" value = " " /> show paragraphs </ button> </ form> <p id="hiddenTest" /> the button above can control the display and I lost, oh. ... </ P>
- DOM What can be done?
- The following section: DOM structure
HTML DOM Notes directory
- DOM What can be done?
- DOM structure
- Visit DOM node 1 - getElementById ()
- Visit DOM node 2 - getElementsByTagName ()
- Part of
