Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
Menulis di teks editor
Bagaimana cara agar tag seperti <head><body> berwarna
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><html> <head> <link rel="stylesheet" href="<a href="http://localhost/tryit/lib/codemirror.css">lib/codemirror.css</a>"> <script src="<a href="http://localhost/tryit/lib/codemirror.js">lib/codemirror.js</a>"></script> <script src="<a href="http://localhost/tryit/lib/codemirror_jsx.js">lib/codemirror_jsx.js</a>"></script> </head> <body> <textarea id="code" name="code"> <script> function colorcoding() { var ua = navigator.userAgent; //Opera Mini refreshes the page when trying to edit the textarea. if (ua && ua.toUpperCase().indexOf("OPERA MINI") > -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(); </script> </body> </html></pre><div><br>Semoga membantu.</div>