PHPSpellCheck has a full JavaScript API that can be used at runtime to capture user events and modify spellchecker behaviour.
You can access your existing PHPSpellCheck AsYouType and SpellButton objects in JavaScript using their ID attribute as their JavaScript object name.
<?php
require "/phpspellcheck/include.php";
$mySpell = new SpellCheckButton();
$mySpell->InstallationPath = "/phpspellcheck/";
echo $mySpell->SpellImageButton();
?>
<script type='text/javascript'>
var mySpellObject = <?php echo ($mySpell->ID)?>;
mySpellObject.onDialogOpen = function(){
alert("onDialogOpen event fired")
}
</script>
As-You-Type user spelling events follow the exact same syntax...
<?php
$mySpell = new SpellAsYouType();
$mySpell->InstallationPath = "/phpspellcheck/";
echo $mySpell->Activate();
?>
<script type='text/javascript'>
var mySpellObject = <?php echo ($mySpell->ID)?>;
mySpellObject.onChangeWord = function(){
alert("onChangeWord event fired from content spellcheck")
}
</script>
Read the Javascript-AJAX-Spell-Check-APIObject Reference...
Events can apply to both as-you-type and in dialog spellchecking as needed: