Learn how to create and use a Syntax Highlighter.
Code snippets are easier to read when you add some color:
A <div> containing HTML code:
<div id="myDiv">
<!DOCTYPE html><br>
<html><br>
<body><br>
<br>
<h1>Testing an HTML Syntax Highlighter</h2><br>
<p>Hello world!</p><br>
<a href="https://www.91xjr.com">Back to School</a><br>
<br>
</body><br>
</html>
</div>
Create a function called "w3CodeColor" and call it, using the DIV element as a parameter:
w3CodeColor(document.getElementById("myDiv"));
function w3CodeColor(elmnt) {
// click "Try it Yourself" to see the JavaScript...
}
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!