HTML DOM modification


  Translation results:

Modify HTML = change elements, attributes, styles and events.

HTML DOM modificationsyntax

Modifying the HTML DOM means many different things:

Changing HTML content

Changing CSS styles

Changing HTML attributes

Creating new HTML Element

Delete existing HTML element

Change event (handler)

HTML DOM modificationexample

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>

<p id="p1">Hello World!</p>

<script>
document.getElementById("p1").innerHTML="新文本!";
</script>

<p>段落通过脚本来修改内容。</p>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A