• 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 js function in ICEFaces

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
i have a problem.
scenario:
I am developing a quiz game on which i need to display timer using javascript (jquery.timer.js).
I have created a js file (question.js) (containing a method called as startTimer), which calls jquery.timer.js function for the timer and display timer on the screen.

On clicking of answer button I am calling managed bean method for validating user answer
and if answer is correct I am changing the question on the screen.

My Queries :
1) How can I include the two js files (question.js and jquery.timer.js)
2) How can I call the js function (startTimer) when my form loads, or when question changes on screen.

Note:
I am using facelet and I need to do above in myquiz.xhtml which contains ui:composition tag.

can anyone help me on this scenario.

any help is appreciable

thanks & regards
rajeshwar
 
Saloon Keeper
Posts: 27791
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the standard HTML link elements to include JavaScript files, just like you would in plain HTML. Some JSF tagsets do support a special "include script" tag which has the added convenience that it allows you to use an app-relative URL to find the script instead of having to hard-code the application context part of the script URL. I can't tell if IceFaces is one of them - they don't seem to carry a "reference card" listing of the tags available for quick lookup.

jQuery has a standard and well-documented way of calling functions when a page has loaded. You can use this to start your timer.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic