JavaScript dynamically changes page elements and javascript dynamic pages
You can use JavaScript to dynamically change HTML elements.
Add elements to HTML
First, you need to create a tag, then add the corresponding content to the tag, and then add the created tag to the corresponding location.
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Delete an element in HTML
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Javascript cannot dynamically change the id of an element in a webpage.
<Input type = 'text' id = "a">
<Input type = 'button 'onclick = "document. all ('A'). id = 'B'">
The button can only be pressed once, and it cannot be seen in the source file after the text ID is changed, but when you click the button again, it will show that there is no a object.
How does javascript modify the content of elements on a webpage?
Dynamic refers to the dynamic nature of data in webpages. For example, for news websites, data must be dynamic before it can be updated in real time.
Js changes the webpage element content to see what you want to change
For text, you must first put an object on the page, for example:
<Span id = mytext> </span>
// Js
Document. all ["mytext"]. innerText = "set text content ";