Тема: Редактор с подсветкой синтаксиса (HTA, JS)
Как сделать цикл чтобы он обрабатывал всё что введётся в <div> и заменял на нужное, поставил while но он полностью тормазит весь скрипт.
<html>
<title>Editor with syntax highlighting</title>
<head>
<META Http-equiv="MSThemeCompatible" content="Yes">
<script>
function GUISetPosition(Left, Top, Width, Height){
if (Left == -1){ Left = ((window.screen.width / 2) - (Width / 2)); }
if (Top == -1){ Top = ((window.screen.height / 2) - (Height / 2)); }
window.resizeTo(Width, Height);
window.moveTo(Left, Top);
}
function Highlight(){
while (true) {
var str = window.document.getElementById("QControlEdit").innerHTML;
var str = str.replace('#include', '<font color="#D67FFF"><kbd><em>#include</em></kbd></font>');
window.document.getElementById("QControlEdit").innerHTML = str;
break;
}
}
GUISetPosition(-1, -1, 669, 338);
</script>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="WMPTour"
BORDER="thick"
BORDERSTYLE="normal"
CAPTION="yes"
maximizeButton="yes"
minimizeButton="yes"
ICON="explorer.exe"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="normal"
/>
</head>
<style>
* {
margin: 0;
padding: 0;
}
body {
margin: 0;
padding: 0;
overflow: hidden;
border: none;
}
.ClassEditor {
position: releative;
left: 0px;
top: 0px;
padding: 5px;
background-color: #F4F4F4;
width: 100%;
height: 100%;
overflow: auto;
color: #808080;
}
</style>
<body onLoad="Highlight();">
<div id="QControlEdit" class="ClassEditor" contenteditable="true">
#include
</div>
</body>
</html>
