Menulis di teks editor

Bagaimana cara agar tag seperti <head><body> berwarna

avatar ridzkyrabbani
@ridzkyrabbani

1 Kontribusi 0 Poin

Diperbarui 3 tahun yang lalu

1 Jawaban:

<div>Pakai code highlighter, seperti :<br>1. Codemirror. dll (anda bisa mencari di google menggunakan kata kunci "code highlighter").<br><br>Contoh penggunaannya :</div><pre>&lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" href="<a href="http://localhost/tryit/lib/codemirror.css">lib/codemirror.css</a>"&gt; &lt;script src="<a href="http://localhost/tryit/lib/codemirror.js">lib/codemirror.js</a>"&gt;&lt;/script&gt; &lt;script src="<a href="http://localhost/tryit/lib/codemirror_jsx.js">lib/codemirror_jsx.js</a>"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;textarea id="code" name="code"&gt; &lt;script&gt; function colorcoding() { var ua = navigator.userAgent; //Opera Mini refreshes the page when trying to edit the textarea. if (ua &amp;&amp; ua.toUpperCase().indexOf("OPERA MINI") &gt; -1) { return false; } window.editor = CodeMirror.fromTextArea(document.getElementById("code"), { mode: "text/html", htmlMode: true, lineWrapping: true, smartIndent: false, addModeClass: true }); // window.editor.on("change", function () {window.editor.save();}); } colorcoding(); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</pre><div><br>Semoga membantu.</div>

avatar syahid246
@syahid246

70 Kontribusi 160 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban