Javascript 将此js代码从内联更改为外部

Javascript 将此js代码从内联更改为外部,javascript,Javascript,在查找了内联与外部javascript的良好实践后,外部javascript似乎总是最好的,因此我有以下代码: $(function() { $('textarea').sceditor({ charset: 'UTF-8', plugins: 'bbcode', width: "100%", autoExpand: true, toolbar: "bold,italic,underline,strike,quote|bulletlist|left

在查找了内联与外部javascript的良好实践后,外部javascript似乎总是最好的,因此我有以下代码:

$(function() {
    $('textarea').sceditor({
    charset: 'UTF-8',
    plugins: 'bbcode',
    width: "100%",
    autoExpand: true,
    toolbar: "bold,italic,underline,strike,quote|bulletlist|left,center,right|link,unlink|youtube,emoticon,image|pastetext|removeformat|maximize|source",
    style: "/includes/jscripts/sce/jquery.sceditor.default.min.css",
    enablePasteFiltering: true,
    // Emoticons list
    emoticons: {
    dropdown: {
    ":><:": "/includes/jscripts/sce/emoticons/angry.png",
    ":'(": "/includes/jscripts/sce/emoticons/cry.png",
    ":dizzy:": "/includes/jscripts/sce/emoticons/dizzy.png",
    ":D": "/includes/jscripts/sce/emoticons/grin.png",
    "^_^": "/includes/jscripts/sce/emoticons/happy.png",
    "<3": "/includes/jscripts/sce/emoticons/heart.png",
    ":huh:": "/includes/jscripts/sce/emoticons/huh.png",
    ":|": "/includes/jscripts/sce/emoticons/pouty.png",
    ":(": "/includes/jscripts/sce/emoticons/sad.png",
    ":O": "/includes/jscripts/sce/emoticons/shocked.png",
    ":sick:": "/includes/jscripts/sce/emoticons/sick.png",
    ":)": "/includes/jscripts/sce/emoticons/smile.png",
    ":P": "/includes/jscripts/sce/emoticons/tongue.png",
    ":S:": "/includes/jscripts/sce/emoticons/unsure.png",
    ":woot:": "/includes/jscripts/sce/emoticons/w00t.png",
    ":whistle:": "/includes/jscripts/sce/emoticons/whistle.png",
    ";)": "/includes/jscripts/sce/emoticons/wink.png",
    ":wub:": "/includes/jscripts/sce/emoticons/wub.png"
        }}
        }).change(function(e){
            var $this = $(this),
                $preview = $this.siblings('#preview');

        });
});
$(函数(){
$('textarea').sceditor({
字符集:“UTF-8”,
插件:“bbcode”,
宽度:“100%”,
自动展开:对,
工具栏:“粗体、斜体、下划线、删除、引用|公告列表|左、中、右|链接、取消链接| youtube、表情符号、图像|粘贴文本|删除格式|最大化|源”,
样式:“/includes/jscript/sce/jquery.sceditor.default.min.css”,
enablePasteFiltering:true,
//表情符号列表
表情符号:{
下拉列表:{

“:>只需将此内容复制到类似myjs.js的文件中,并使用

<script src="myjs.js"></script>


因为它使用的是jQuery,所以在导入jQuery之后应该会包含此文件

只需将此内容复制到类似myjs.js的文件中,并使用

<script src="myjs.js"></script>


由于它使用的是jQuery,因此在包含jQuery之后,应该先加载jQuery,然后加载插件,然后加载脚本中的外部文件。加载jQuery,然后加载插件,然后加载脚本中的外部文件。@Liam Dawe您能分享包含的其他脚本文件和脚本吗order@LiamDawe还要检查是否有有什么错误吗console@LiamDawe您可以分享其他脚本文件以及order@LiamDawe还要检查控制台中是否有任何错误