Modify the web page
Auto SpellChecker support can be embedded into a web page
by adding an additional frame. If the page is already a part
of a frameset, a new hidden frame should be added. If the
target page is not a part of the frameset, it should be
wrapped into the frameset.
1. Add a new frame to your frameset by entering the
following html code:
<frame name=AutoChecker src="SPROXY_URL?cmd=init" marginHeight=0
marginWidth=0 scrolling=no noresize height=0
frameborder="no">
SPROXY_URL should be replaced
with the actual URL of the sproxy.cgi file on your server.
2. Change the parameters of the <FRAMESET> tag
to make this a hidden (zero length) frame. For example,
if you add the frame as the first <FRAMESET> tag, change
your code to (note the 0 values within the code):
<frameset cols="0,*" frameborder="0"
framespacing="0" border="0">
<frame
name="AutoChecker" src="http://your_server/cgi-bin/sproxy.cgi?cmd=init"
marginheight=0 marginwidth=0 scrolling=no noresize
height=0>
<frame
src="menu.html">
</frameset>
3. Add the following code in the header (between
"<head>" and "</head>" tags) of the page in which
SpellChecker will be used:
<script>
<!--
var
frmname = 'FORM_NAME ';
function
SetEnabling_ASC(enbl)
{
document.forms[frmname].enabling.checked
= enbl;
}
function doSubmit_ASC(ctrl)
{
if
(parent.frames['AutoChecker'] &&
parent.frames['AutoChecker'].checkText)
return
parent.frames['AutoChecker'].checkText(ctrl);
else
return
!document.forms[frmname].enabling.checked;
}
function
setOpts_ASC()
{
parent.frames['AutoChecker'].adjustOptions();
}
function
doLoad_ASC()
{
if
(parent.frames['AutoChecker'])
if
(parent.frames['AutoChecker'].isAutoSpellCheckEnabled)
document.forms[frmname].enabling.checked =
parent.frames['AutoChecker'].isAutoSpellCheckEnabled();
}
function
enable_disable_ASC()
{
parent.frames['AutoChecker'].setAutoSpellCheckEnabling(
document.forms[frmname].enabling.checked
);
}
//-->
</script>
FORM_NAME should be replaced
with name of the form in which text control will be
checked.
Layout Auto SpellChecker controls
Add to your web page the following code:
<input type="checkbox"
name="enabling" onclick="enable_disable_ASC();" checked>
Auto Spell Check.
<input type="button"
onclick="setOpts_ASC();" value= "Options">
Setting up the onLoad event
1. Find the <BODY> tag in your page.
2. Add the following code within this tag:
onLoad="return doLoad_ASC();"
If you already have the onLoad event handler in your page,
add the above code inside the onLoad event.
For
example:
Before changing
<body
onLoad="doMyLoad()">
After changing
<body
onLoad="doLoad_ASC(); doMyLoad()">
or
<body onLoad="doMyLoad();
doLoad_ASC()">
Setting up the onSubmit event
1. Find the <FORM> tag in your page.
2. Add the following code to this tag:
onSubmit="return
doSubmit_ASC(this['ELEMENT_NAME']);"
ELEMENT_NAME should be replaced
with the name of the control text to be checked by Auto
SpellChecker.
3. If the <FORM> tag has already onSubmit event,
find all subsequent references to the onSubmit event
(submit(), SomeFor.Submit(),
document.forms[formname].Submit(), <input type=submit…>
etc.) and replace them with the following code:
doSubmit_ASC(FORM_NAME['ELEMENT_NAME'])
For example:
Before changing:
......
<script>
<!--
......
function
MyHandler()
{
......
if
(SomeFlag)
{
......
document.forms[SomeForm].submit();
}
else
{
......
}
......
document.SomeForm.submit();
}
......
//-->
</script>
......
<form
name=SomeForm onSubmit="return MyHandler();"
......>
......
<textarea
name=SomeText......>
......
</form>
......
After changing:
......
<script>
<!--
......
function
MyHandler()
{
......
if
(SomeFlag)
{
......
doSubmit_ASC(document.Forms[SomeForm].SomeText);
return
false;
}
else
{
......
}
......
doSubmit_ASC(document.forms[SomeForm].SomeText);
return
false;
}
......
//-->
</script>
......
<form
name=SomeForm onSubmit="return MyHandler();"
......>
......
<textarea
name=SomeText......>
......
</form>
......