这个问题在这里已经有一个答案:>
Dynamically access object property using variable7个
var tinymce_toolbar = {} tinymce_toolbar.__default = { script_url: '/cms/libs/js/manual/renders/tiny_mce/tiny_mce.js',}; tinymce_toolbar.__simple = { script_url: '/cms/libs/js/manual/renders/tiny_mce/tiny_mce_simple.js',}; // Doesn't work var t = $(this).find('input[name=toolbar]').first().val(); $('.RenderHtmlEditor').tinymce(tinymce_toolbar.t); // works var t = $(document).find('input[name=toolbar]').first().val(); $('.RenderHtmlEditor').tinymce(tinymce_toolbar.__default); $('.RenderHtmlEditor').tinymce(tinymce_toolbar.__simple);
我如何做到动态?谢谢