Creating dynamic pages involves direct access to existing elements, creating new ones and changing their properties. Using the document.getElementById JavaScript method allows you to find a page element with the specified identifier and change its properties.
The method is applicable to all HTML tags that have a unique identifier "id". It is mainly used to change the properties and content of div tags.
Page Elements
The HTML hypertext format allows you to describe unique elements and class elements. By definition, a unique element is always one on a page, and there can be many class elements.
DOM, . , .
CSS : , (). : scHeader, scContent scFooter.
«body» JavaScript: iLoadHeight, iLoadWidth Y . X , .
: dHeader, dContent dFooter.
JavaScript getElementById dHeader, dContent dFooter .
, , .
JavaScript getElementById . , :
- dHeader.innerHTML = 'Start: Y=' + iHeaderCooY + '; H=' + iHeaderSizeY;
- dContent.innerHTML = 'Start: Y=' + iContentCooY + '; H=' + iContentSizeY;
- dFooter.innerHTML = 'Start: Y=' + iFooterCooY + '; H=' + iFooterSizeY;
, Y .
innerHTML , .
, , , . , , CSS.
JavaScript getElementById - . CSS. «style», () CSS. «style.top», «style.left». .
, JavaScript getElementById : . , , , . , .