This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes Getting the top 3 keywords from a text content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Getting the top 3 keywords from a text content" Watch "Getting the top 3 keywords from a text content" New topic
Author

Getting the top 3 keywords from a text content

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9351
    
    2

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?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

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.)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9351
    
    2

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

Joined: Jan 10, 2002
Posts: 61092
    
  66

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

Joined: Sep 26, 2006
Posts: 9351
    
    2

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

Joined: Jan 10, 2002
Posts: 61092
    
  66

That's not defined either.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9351
    
    2

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting the top 3 keywords from a text content