向我的网站添加拼写检查

发布于 2024-08-15 03:55:58 字数 477 浏览 9 评论 0原文

我有一个基于 asp 的网站,我想向页面上的文本区域元素添加拼写检查功能。大多数页面都是由引擎生成的,尽管我可以向其中添加 JavaScript。所以我的首选解决方案是基于 JavaScript 的解决方案。我已经尝试过 JavaScriptSpellCheck 并且它工作正常,尽管我想看看我的其他一些选项可能是什么。我还找到了 spellchecker.net,但服务器许可证的价格为 3500 美元,这似乎有点过高。

拼写检查可以在单独的窗口中进行,并且必须支持多种语言(越多越好)。最后,我想向拼写检查对象发送文本区域名称或 ID 的集合或分隔字符串(最好是页面中已存在的名称),并对其进行所有拼写检查,并在纠正拼写时更新文本。

I have an asp-based website which I would like to add spell checking capabilities to the textarea elements on the page. Most of the pages are generated from an engine, though I can add JavaScript to them. So my preferred solution is a JavaScript-based one. I have tried JavaScriptSpellCheck and it works okay, though I would like to see what some of my other options may be. I also found spellchecker.net but at $3500 for a server license it seems excessive.

Spell checking can be in a separate window and must support multiple languages (the more the better). Ultimately I would like to send the spell check object a collection or delimited string of textarea names or id's (preferably names as they already exist in the pages) and have it spell check all of them, updating the text as spelling is corrected.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

染墨丶若流云 2024-08-22 03:55:58

这是我编写的一个免费开源 Javascript 库,用于拼写检查:

https://github .com/LPology/Javascript-PHP-Spell-Checker

顶部有一个现场演示的链接。它的设计给人一种桌面文字处理器中拼写检查器的感觉。我在对这些相同的选项不满意后写了它。

要使用,只需将 JS 和 CSS 文件包含到您的页面中,然后添加以下内容:

var checker = new sc.SpellChecker(
    button: 'spellcheck_button', // opens the spell checker when clicked
    textInput: 'text_box', // HTML field containing the text to spell check
    action: '/spellcheck.php' // URL of the server side script 
);

它包含用于拼写检查的 PHP 脚本,但只要它返回正确的 JSON 响应,就可以相当容易地将其移植到其他语言。

Here is a free, open source Javascript library for spell checking that I authored:

https://github.com/LPology/Javascript-PHP-Spell-Checker

There's a link to a live demo at the top. It's designed to have the feel of a spell checker in a desktop word processor. I wrote it after being dissatisified with these same options.

To use, just include the JS and CSS files into your page, and then add this:

var checker = new sc.SpellChecker(
    button: 'spellcheck_button', // opens the spell checker when clicked
    textInput: 'text_box', // HTML field containing the text to spell check
    action: '/spellcheck.php' // URL of the server side script 
);

It includes a PHP script for spell checking, but it could be ported to another language fairly easily as long as it returns the correct JSON response.

荆棘i 2024-08-22 03:55:58

如果我是你,我会研究类似 aspell 的东西 - 这被用作 TinyMCE 中支持的拼写检查后端之一。就我个人而言,我使用 pspell 因为它已集成到 PHP 中。

编辑

这里有一个aspell集成,它有PHP或Perl/CGI版本;可能值得一看。

If I were you, I'd look into something like aspell - this is used as one of the supported spellchecking backends in TinyMCE. Personally, I use pspell because it's integrated into PHP.

EDIT

There's an aspell integration here that has a PHP or a Perl/CGI version; might be worth checking out.

明媚殇 2024-08-22 03:55:58

如果我没记错的话,Firefox 的拼写检查英语词典需要大约 800KB 的数据。

如果您喜欢在 JavaScript 中完成所有操作 - 对于功能齐全的拼写检查引擎,这意味着您需要在每次页面加载时加载 800KB 的数据。这确实不是一个好主意。

因此,不要在 JavaScript 中执行此操作,而是使用 AJAX 将数据发送到服务器,在服务器端检查,然后返回;这是最好的办法。

If I am not wrong, Firefox's English dictionary for spell checking takes around 800KB of data.

If you like to do everything in JavaScript -- for a full-featured spell checking engine, it means you need to load that 800KB data in every page load. It's really not a good idea.

So, instead of doing that in JavaScript, send the data to the server with AJAX, check it server side, and return it back; that's the best way.

錯遇了你 2024-08-22 03:55:58

嗯,这是一个很老的问题,但我的回答可能会帮助那些正在寻找这个问题的最新选项的人。

“JavaScript SpellCheck”是业界领先的 JavaScript 拼写检查器插件。它允许开发人员在几乎任何 HTML 环境中轻松添加和控制拼写检查。您可以通过将文件夹复制到您的网站来在大约 5 分钟内安装它。

http://www.javascriptspellcheck.com/

还支持多种语言 - http://www.javascriptspellcheck.com/Internationalization_Demo

Well this is quite old question, but my answer might help people who are looking for latest options on this question.

"JavaScript SpellCheck" is the industry leading spellchecker plugin for javascript. It allows the developer to easily add and control spellchecking in almost any HTML environment. You can install it in about 5 minutes by copying a folder into your website.

http://www.javascriptspellcheck.com/

Also support multiple languages - http://www.javascriptspellcheck.com/Internationalization_Demo

岛歌少女 2024-08-22 03:55:58

我对这个问题的回答可能有点晚了。我很久以前就找到了解决方案。您必须首先在浏览器上安装拼写检查器。然后使用以下代码作为链接创建一个书签。

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

I might be a bit late on the answer to this question. I found a solution a long while ago. You must have a spell checker installed on your browser first. Then create a bookmark with the following code as the link.

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文