JavaScript版代码高亮(6)

if(typeof(o)=="object"){
  switch(o.tagName){
   case "TEXTAREA":
   case "INPUT":
    _codetxt = o.value;
    break;
   case "DIV":
   case "SPAN":
    _codetxt = o.innerText;
    break;
   default:
    _codetxt = o.innerHTML;
    break;
  }
 }else{
  _codetxt = o;
 }

var _syn = new CLASS_HIGHLIGHT(_codetxt,syntax);

htmltxt = _syn.highlight();

return  htmltxt;
}
</script>

<script language="JavaScript" type="text/javascript">
function plaster(){
 document.form1.m.focus()
 document.execCommand("Paste")
}

function goit(stx){
 var code = document.getElementById("m").innerText;
 var xx = new CLASS_HIGHLIGHT(code,stx);
 document.getElementById("highlight").innerHTML = xx.highlight();
}
</script>

<form method="post">
<div><textarea rows="18"></textarea></div>
<input type="button" value="HTML" />
<input type="button" value="VB/VBScript" />
<input type="button" value="JavaScript" />
<input type="button" value="C#" />
<input type="button" value="SQL" />
<input type="button" value="XML" />
<input type="button" value="Java" />
&nbsp;&nbsp;<input type="button" value="粘贴" />
<input type="reset" value="清空内容" />
</form>
<div>

</div>
<div><div>
</div>
</body>
</html>

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjjxzj.html