hi there,

i am building a firefox extension for my final project. i am stuck at the last leg. i need a javascript command that gets two words before, and two words after a highlighted word (a window of 5 words) into my program. i can get the highlighted word, but not the two words before n two words after in the sentence.

i have tried googling but no luck. i wonder if anyone can help me urgently because i am running out of time.

thanks :)

<script type="text/JavaScript">
var line;
var word;
var word2;
var word3;
test = '';
word1 = "How";
word2 = " are";
word3 = " you?";
line += word1;
line += word2;
line += word3;
document.write(line);
</script>

Will result in:

How are you?

Not sure I completely understand the question...But have you tried using arrays?

commented: bumping a year old thread +0
Member Avatar for rajarajan2017

Post your code what you have written yet/

commented: bumping a year old thread +0

Old thread you blokes.

Member Avatar for rajarajan2017

Oh! sorry. Some persons make this thread as new (confusion) by replying to that thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.