How to change HTML style with JavaScript HTML DOM (Document Object Model)

1 Answer

0 votes
<!DOCTYPE html>
<html>

<head></head>

<body>

<p id="p-id">JavaScript HTML DOM</p>

<script>

document.getElementById("p-id").style.color = "dodgerblue";
document.getElementById("p-id").style.backgroundColor = "gainsboro";

/*
run:

"JavaScript HTML DOM" with the colors we set

*/

</script>

</body>

</html>

 



answered Jul 7, 2015 by avibootz

Related questions

2 answers 402 views
1 answer 287 views
2 answers 7,142 views
1 answer 484 views
1 answer 317 views
2 answers 409 views
...