gpt4 book ai didi

javascript - 如何在 NicEdit 中设置在新窗口中打开链接的默认值

转载 作者:行者123 更新时间:2023-12-02 16:36:35 24 4
gpt4 key购买 nike

使用 NicEdit 时,可以使用编辑器中的“添加链接”按钮突出显示文本,以便可以对其进行超链接。

单击“添加链接”按钮时,会出现一个弹出窗口,您可以在其中指定链接是应在新窗口中打开还是在当前窗口中打开。默认为“当前窗口”。

我假设在第 72 行的 javascript 中切换这两个选项的顺序会将默认值从“当前窗口”更改为“新窗口”。但是,事实并非如此。

如何使用 NicEdit 设置添加的链接的默认值在新窗口而不是当前窗口中打开?

以下是 NicEdit javascript 中的相关代码。

var nicLinkOptions = {
buttons : {
'link' : {name : 'Add Link', type : 'nicLinkButton', tags : ['A']},
'unlink' : {name : 'Remove Link', command : 'unlink', noActive : true}
}

};

var nicLinkButton=nicEditorAdvancedButton.extend({addPane:function(){this.ln=this.ne.selectedInstance.selElm().parentTag("A");this.addForm({"":{type:"title",txt:"Add/Edit Link"},href:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},title:{type:"text",txt:"Title"},target:{type:"select",txt:"Open In",options:{_blank:"New Window","":"Current Window"},style:{width:"100px"}}},this.ln)},submit:function(C){var A=this.inputs.href.value;if(A=="http://"||A==""){alert("You must enter a URL to Create a Link");return false}this.removePane();if(!this.ln){var B="javascript:nicTemp();";this.ne.nicCommand("createlink",B);this.ln=this.findElm("A","href",B)}if(this.ln){this.ln.setAttributes({href:this.inputs.href.value,title:this.inputs.title.value,target:this.inputs.target.options[this.inputs.target.selectedIndex].value})}}});nicEditors.registerPlugin(nicPlugin,nicLinkOptions);

最佳答案

更改顺序是正确的方法,但使用“_self”作为“当前窗口”,这对我有用。

并注意双引号或单引号

关于javascript - 如何在 NicEdit 中设置在新窗口中打开链接的默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27875381/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com