• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

calling javascript

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
Is it possible to call a javascript function without any click or anything..hmm lemme explain
i have a jsp page that refreshes automactically every 10 sec. Each time while refreshing i check the value returned by a java bean, if that value is greater than 0 (zero) i want to call another javascript function.. is it possible ?? i think im not confusing u ...
any other suggestion on the logic is appretiated..
Thanx
Raj
SCJP2
 
Sheriff
Posts: 67746
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
Sounds like something you might want to handle with on "on load" handler for your body tag.
For example:

(remove the underscore from on_load)
This will cause the doSomething() function to fire every time the page is loaded. Is that what you are after?
hth,
bear
P.S. Before too long, this forum's bartender will ask you to change your name to one that conforms to the forum policy. You might want to be a good cowboy and beat him to the punch!
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your name does not follow the JavaRanch Naming Policy. Your name should be two words, firstname then last name with a space in the middle. This naming policy is enforced to promote a professional atmosphere in the forums.
Can you please re-register with a valid name.
Thank You,
Eric
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi bear/eric,
thanks for ur reply..I solved the prob myself i just had to add a script at the end of the jsp..its working now.. thanks
regarding the naming policy..my name is Rajeev.R, so in short i kept it as raj r. anyway i'l change it soon to something else to bcome a professional cowboy !!
cheers
Raj
SCJP2
 
Bear Bibeault
Sheriff
Posts: 67746
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
I'd still advocate the use of the on_load handler. That guarentees that the JavaScript will not execute until the entire doucment has loaded. Putting the script in-line can sometimes lead to hard-to-debug race conditions when the script executes before something it needs to refer to has finished loading.
hth,
bear
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic