• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the top 3 keywords from a text content

 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I run into some problems when I execute the following javascript at the line mentioned inline in the source code below,



Can you please help me out?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jothi Shankar Kumar wrote:I run into some problems when I execute the following javascript ...

Does your keyboard burst into flame?

(In other words, just telling us "you have a problem" doesn't do anything to tell us what it is.)
 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I have mentioned the problem as an inline comment in the code above. It gives me an Object Expected javascript error in the line

<input type="submit" name="Submit" value="Calculate Keyword Density" onclick="javascript: count('txtId');">

which I do not understand.

Actually, I'm trying to identify the top 3 words that are being used in the textarea. I'm filtering out the unwanted words which I cann stopwords and finding out the density and based on the density, populate the array of top 3 words. Any ideas on why I get an Object Expected javascript error?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jothi Shankar Kumar wrote:Yes, I have mentioned the problem as an inline comment in the code above.
Not a great approach. the harder you make it for people to help you, the less help you are likely to receive.

onclick="javascript: count('txtId');">

What's with the completely unnecessary "javascript:" prefix?

And why should you be surprised that it doesn't know what "count" is when such a function is never defined?
 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for pointing that out. But even after giving the correct method name and removing the javascript:, I keep getting the same error.

It looks like this now,

<input type="submit" name="Submit" value="Calculate Keyword Density" onclick="calculateKeywordDensity('txtId');">
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not defined either.
 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, corrected the spelling mistake. Later I figured out that I was missing a closing brace in one of the lines inside the calculateKeywordDensity function.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic