导航栏下拉列表没有任何想法?

时间:2015-08-05 03:21:21

标签: javascript jquery css

基本上我使用了演示,我确信所有的js都正确加载....真的需要帮助。 按钮无法切换 以下是我的JS和css

<section id="textarea" contenteditable="true" onkeypress="myFunction();">
    <h2>Go ahead, edit away!</h2>
    <p>Here's a typical paragraph element</p>
    <ol>
      <li>and now a list</li>
      <li>with only</li>
      <li>three items</li>
    </ol>
  </section>



<script>
    var strReg1 = /"(.*?)"/g,
    strReg2 = /'(.*?)'/g,
    specialReg = /\b(new|var|if|do|function|while|switch|for|foreach|in|continue|break)(?=[^\w])/g,
    specialJsGlobReg = /\b(document|window|Array|String|Object|Number|\$)(?=[^\w])/g,
    specialJsReg = /\b(getElementsBy(TagName|ClassName|Name)|getElementById|typeof|instanceof)(?=[^\w])/g,
    specialMethReg = /\b(indexOf|match|replace|toString|length)(?=[^\w])/g,
    specialPhpReg  = /\b(define|echo|print_r|var_dump)(?=[^\w])/g,
    specialCommentReg  = /(\/\*.*\*\/)/g,
    inlineCommentReg = /(\/\/.*)/g;

var htmlTagReg = /(&lt;[^\&]*&gt;)/g;




function myFunction() {
  var str = document.getElementById("textarea").innerHTML; 
  document.getElementById("textarea").innerHTML = str.replace(strReg1, '<font color="red">"$1"</font>'); 
    document.getElementById("textarea").innerHTML = str.replace(strReg2,'<font color="green">"$1"</font>');

}
</script>

`

0 个答案:

没有答案