<html>
<head>
<title>Spell Check Tester</title>
<script src="spellChecker.js"></script>
<script>
//
// openSpellChecker()
//
// this function is an example that illustrates the various ways you can invoke
// the the Speller Pages spell-checking process
//
function openSpellChecker() {
// example 1.
// Pass in the text inputs or textarea inputs that you
// want to spell-check to the object's constructor,
// then call the openChecker() method.
/*
var text1 = document.form1.text1;
var textarea1 = document.form1.textarea1;
var speller = new spellChecker( text1, textarea1 );
speller.openChecker();
*/
// example 2.
// Rather than passing in the form elements to the object's
// constructor, populate the object's textInputs property,
// then call the openChecker() method.
var speller = new spellChecker();
var spellerInputs = new Array();
for( var i = 0 ; i < document.form1.elements.length; i++ ) {
if( document.form1.elements[i].type.match( /^text/ )) {
spellerInputs[spellerInputs.length] = document.form1.elements[i];
}
}
speller.textInputs = spellerInputs;
speller.openChecker();
/*
// example 3.
// use the spellCheckAll() method to check every text input
// and textarea input in every form in the HTML document.
// You can also use the checkTextBoxes() method or checkTextAreas()
// method instead of spellCheckAll() to check only text inputs
// or textarea inputs, respectively
var speller = new spellChecker();
speller.spellCheckAll();
*/
}
</script>
</head>
<body>
<h1>Speller Pages</h1>
<form name="form1">
<input type="text" name="text1" size="30">
<br />
<textarea name="textarea1" rows="10" cols="60"></textarea>
<br />
<input type="button" value="Check Spelling" onClick="openSpellChecker();"/>
</form>
</body>
</html>