CKeditor - html Onclick属性不起作用

时间:2016-02-05 09:03:59

标签: html ckeditor ckeditor4.x

我使用下面的代码在新窗口中打开谷歌但在CKeditor中这不起作用。

<div align="center"><button onclick="window.open('http://google.com','_self')">Click here to open <b> google </b> 
</button></div>

2 个答案:

答案 0 :(得分:1)

将您的HTML更改为:

<div align="center"><!--                              ▾ Here -->
    <button onclick="window.open('http://google.com','_blank')">
        Click here to open <b> google </b> 
    </button>
</div>

_blank让浏览器知道必须进入新窗口。

JsFiddle示例

修改

请尝试查看:CKEDITOR - how to add permanent onclick event?

希望这有帮助!

答案 1 :(得分:1)

将_self更改为_blank

    <div align="center"><button onclick="window.open('http://google.com','_blank')">Click here to open <b> google </b>
    </button></div>

这应该有用。