如何在ExtjS中将javaScript代码加载到textarea

如何在ExtjS中将javaScript代码加载到textarea,javascript,extjs,Javascript,Extjs,如何将javaScript代码加载到ExtjS表单面板中的textarea?? 这是我的代码,但仍然有错误 我的代码: { fieldLabel: 'Code' xtype: 'textareafield', autoScroll: 'auto', width: '100%', height: '100%', loader: { url: 'https://localhost/springapp/js/app/vie

如何将javaScript代码加载到ExtjS表单面板中的textarea?? 这是我的代码,但仍然有错误

我的代码:

 {
     fieldLabel: 'Code'
     xtype: 'textareafield',
     autoScroll: 'auto',
     width: '100%',
     height: '100%',
     loader: {
         url: 'https://localhost/springapp/js/app/view/component/codesnippet.js',
         autoLoad: true,
         renderer: function(loader, response, active) {
                 var text = new String(response.responseText);
                 text = text.replace(/&/mg, '&');
                 text = text.replace( //mg, '>');
                 text = text.replace(/\"/mg, '"');
                 text = text.replace(/\t/g, ' '); 
                 text = text.replace(/\r?\n/g, ''); 
                 text = text.replace( //g,'');
                 text = text.replace( //g, ' ');
                 loader.getTarget().update(text);
                 return true;
         }
     }
}

通过路径/springapp/js/app/view/component/检查js文件codesnippet.js,似乎没有,而且别忘了跨域限制可以加载远程内容

正则表达式错误

1. text = text.replace( //g, '>'); // what is symbol for replace?
2. text = text.replace(//g, '');// what is symbol for replace?
3. text = text.replace(//g, ' ');// what is symbol for replace?

请从控制台提供错误消息。首先,代码有一些语法错误。下一行是错误的text=text.replace//mg,'>';。它的计算结果为text=text.replace,因为您已经对行的其余部分进行了注释。其他线路也是如此。然而,代码对我来说是有效的。