我想保存PHP本身生成的所有CodeMirrors onBlur。这就是我所说的:
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没有定义”......怎么做?
答案 0 :(得分: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();
}
});
这就像一个魅力