<html>
<body>
<h3>A demonstration of how to access a CODE element</h3>
<code id="myCode">A piece of computer code</code>
<p>Click the button to set the color of the code element to red.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var x = document.getElementById("myCode");
x.style.color = "red";
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_code_get by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 05 Sep 2022 15:25:23 GMT -->
</html>