/    Sign up×
Community /Pin to ProfileBookmark

Help please…

hello!
I’ve downloaded a sample javascript code but I wanted to add check grammar/spelling feature. However, Im having problems with it.
Although I have a code that opens the check grammar & spelling, however it still needs some fixing. please help me.

bug 1:whenever I click the spelling button, the html tags are also displayed in the check grammar & spelling window. but
if I change the innerHTML to innerText, after checking the spelling, the format was lost.

bug 2: if the check grammar & spelling window was visible and I clicked the cancel button, the contents of my text area was deleted.

the sample text that I used is having a table & bulleted list with wrong spelling. please help me improve my code.

heres the part where the code revision is required:

// Spelling
else if (id == “spelling”)
{
document.getElementById(“wysiwyg” + n).contentWindow.focus();

objWord = new ActiveXObject(“Word.Application”)
objWord.WindowState = 2

objWord.Documents.Add()
objWord.Selection.text=document.getElementById(“wysiwyg” + n).contentWindow.document.body.innerText.replace(/^s+/,””).replace(/s+$/,””)
objWord.ActiveDocument.CheckGrammar()
objWord.Visible=true;
objWord.Activate();
document.getElementById(“wysiwyg” + n).contentWindow.document.body.innerHTML= objWord.Selection.text;
objWord.ActiveDocument.Close(0);
objWord.Quit();
objWord = null
alert(“Spell Check Complete”);
if (top.opener || parent.window.dialogArguments)
{
self.close();
}

}

Thank you

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @venussa spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...