2
如果有某些字段使用htmleditor的要求。所以對於使用htmleditor的每個字段,我已經創建了一個編輯器模板,它使用jquery呈現htmleditor,並使用UIHint。mvc javascript多次
@model System.String
<script type="text/javascript" src="~/Scripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" language="javascript">
tinyMCE.init({
mode: "textareas",
theme: "advanced",
editor_selector: "htmlmarker",
theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter, justifyright,justifyfull,|,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: "hr,removeformat,visualaid,|,sub,sup",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left"
});
</script>
@Html.TextAreaFor(model => model, new {@class="htmlmarker" })
現在evreything作品不錯,但在執行時,我認爲我的源獲取jQuery的腳本會被引用,並呼籲多次爲使用UIHint各個領域。有沒有什麼機制來防止JavaScript代碼的重複?