繁体   English   中英

tinymce 未定义

[英]tinymce is undefined

我正在尝试在 ASP.NET 内容页面中使用 tinymce 。 当我在 VisualStudio2008 中运行代码时,该代码有效。 当我将它部署到 IIS 时,我收到 javascript 错误“错误:'tinyMCE'未定义”

<script src="tinymce/jscripts/tiny_mce/tiny_mce.js" type="text/javascript"></script>
<script type="text/javascript">
tinyMCE.init({
        // General options
        mode : "textareas",
        theme : "advanced",
        plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,

        // Skin options
        skin : "o2k7",
        skin_variant : "silver",

        // Example content CSS (should be your site CSS)
        content_css : "css/example.css",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url : "js/template_list.js",
        external_link_list_url : "js/link_list.js",
        external_image_list_url : "js/image_list.js",
        media_external_list_url : "js/media_list.js",

        // Replace values for the template plugin
        template_replace_values : {
                username : "Some User",
                staffid : "991234"
        }
});
</script>


<textarea id="txtareaEmailEditor" name="content" rows="30" cols="100" runat="server" ></textarea>

编辑:我运行 firebug 并在 net 选项卡下查看它有

GET tiny_mce.js 503 Service Unavailable

更新我将脚本移动到应用程序文件夹并消除了 503 错误,但我仍然收到 tinymce 未定义错误。

<script src="tiny_mce.js" type="text/javascript"></script>

这是我在 IIS http://svr-app-d1/MailServiceWeb/EmailTemplateEditor.aspx中的地址


我从这里的高级开发人员那里得到了一些帮助,他进行了这些更改,现在它可以工作 IIS -> ASP EnableParentPaths=true IIS -> 启用处理程序映射静态文件

路径tinymce/jscripts/tiny_mce/tiny_mce.js与您正在查看的页面相关。 因此,当您在本地查看它时,您可能是从 IIS 中的不同路径查看它。 尝试使用绝对路径:

/tinymce/jscripts/tiny_mce/tiny_mce.js

更新问题后更新答案:

我将脚本移动到应用程序文件夹... <script src="tiny_mce.js" type="text/javascript"></script>我在 IIS 中的地址是svr-app-d1/MailServiceWeb/EmailTemplateEditor.aspx

请改用<script src="/tiny_mce.js" type="text/javascript"></script> 注意前面的/ 这使得路径是绝对的。

解释:

当您在svr-app-d1/MailServiceWeb/EmailTemplateEditor.aspx访问您的页面时,它正在MailServiceWeb目录中寻找tiny_mce.js (如您所知,这是不正确的)。

我从这里的高级开发人员那里得到了一些帮助,他进行了这些更改,现在它可以工作 IIS -> ASP EnableParentPaths=true IIS -> 启用处理程序映射静态文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM