The Article object represents an HTML <article> element.
We can access an <article> element by using getElementById()
:
var x = document.getElementById("myArticle");
Click the button to set the text color of the article content to red.
<!DOCTYPE html> <html> <body> <article id="myArticle"> <h1>Article Heading</h1> <p>Some article text..</p> </article>//from w w w . j a va2s .c om <button onclick="myFunction()">Test</button> <script> function myFunction() { var x = document.getElementById("myArticle"); x.style.color = "red"; } </script> </body> </html>