2

我想将 PHP 本身生成的所有 CodeMirror 保存在 Blur 上。这就是我所说的:

        while ($db_field = mysql_fetch_assoc($result)) {
         ...
            var editor = CodeMirror.fromTextArea(document.getElementById("id'.$db_field['id'].'"), {
              lineNumbers: true,    
              matchBrackets: true,
              mode: "application/x-httpd-php",    
              onBlur: id'.$db_field['id'].'.save()
            });
         ...
         }

但它不起作用...... FireBug 说:“id1 未定义”......怎么做?

4

1 回答 1

0

我在我的代码中发现了错误:

        var id'.$db_field['id'].' = CodeMirror.fromTextArea(document.getElementById("id'.$db_field['id'].'"), {
        lineNumbers: true,    
        matchBrackets: true,
        mode: "application/x-httpd-php",
        onBlur: function(){
          id'.$db_field['id'].'.save();
        },
        onChange: function(){
        $("#changeimg").show();
        }     
        });

这就像一个魅力

于 2011-10-05T14:52:15.130 回答