{% else-1 %}
В качестве примера взят упрощенный синтаксис J2ME

                        
function CheckSyntax() {

var divs = document.getElementsByTagName ("div");

for (i = 0; i < divs.length; i++) {

if(divs[i].id=="code") {

var tmp = divs[i].innerHTML;

tmp = tmp.replace(/(typeof|new|return|if|for|in|while|break|do|continue|switch|case|import|class|public|private|protected|static|final|synchronized|try|catch|extends|super|true|false|byte|int|float|long|double|boolean|implements|interface|this|void)([^a-z0-9$_])/gi, '<span class="shkwrd">$1</span>$2');

tmp = tmp.replace(/(//[^nr]*(n|rn))/g,'<span class="shcomm">$1</span>');

tmp = tmp.replace(/([^a-z(.][A-Z][^(;]*?(s|.))/g,'<span class="shfunc">$1</span>');

tmp = tmp.replace(/([a-z][a-z0-9_]*)(/gi,'<span class="shfunc">$1</span>(');

divs[i].innerHTML = tmp;

}

}

}
-1 28 0
Без комментариев...