• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Getting the top 3 keywords from a text content

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67663
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67663
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67663
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not defined either.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
What are your superhero powers? Go ahead and try them on this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic