简体   繁体   English

功能仅适用于Opera

[英]Function only works in Opera

I wonder if I could get some direction on this problem. 我想知道我是否可以对这个问题有所指导。 I have a forum with a js function to surround text in a message with bb code, but it only works in Opera. 我有一个带有js函数的论坛,可以用bb代码将消息中的文本括起来,但是仅在Opera中有效。 In other browsers, it just doesn't do anything, the highlighted words just become not highlighted any more. 在其他浏览器中,它什么也没做,突出显示的单词变得不再突出显示。 The actual parser to convert from bbcode to html works fine, its just this surroundText function which is not working. 从bbcode转换为html的实际解析器可以正常工作,它只是这个SurroundText函数不起作用。

Here is the routine: 这是例程:

$('.surroundText').click(function(event) {
    event.preventDefault();
    var before = $(this).data('text'),
        after  = $(this).data('text-after');
    surroundText(before, (after) ? after : '');
});

Ultimately I am going to have to install some debugging software and deal with this, but could someone see anything here which is fixable? 最终,我将不得不安装一些调试软件并进行处理,但是有人可以在这里看到任何可修复的东西吗? For some reason Opera works perfectly and everything else doesn't, for a few minor functions on the platform. 由于某种原因,Opera可以完美运行,而其他所有功能则不能正常运行,这是平台上的一些次要功能。 This is the biggest one. 这是最大的。

Edit: Oh and the buttons have this code: 编辑:哦,按钮有此代码:

<a class="bold" href="javascript:void(0);" onclick="surroundText('[b]', '[/b]'); return false;" title="Bold">Bold</a>

This is from a working sample...the code is the same, I was confused. 这是来自一个有效的示例...代码是相同的,我很困惑。 Can anyone see a clear problem? 谁能看到一个明确的问题?

Finally, I figured this out, its so simple. 最后,我弄清楚了,它是如此简单。 The jQuery wasn't loading in the other browsers at all. jQuery根本没有在其他浏览器中加载。 The issue was pretty simple, 问题很简单,

When the JavaScript was loaded, the line looked like this: 加载JavaScript后,该行如下所示:

.script("http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js").wait()

and the problem was that the http: isn't supposed to be there, therefore jQuery wasn't loaded at all. 问题是http:不应该在那里,因此根本没有加载jQuery。

So the proper line is: 因此,正确的行是:

.script("//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js").wait()

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

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