Win a copy of The Career Toolkit this week in the Jobs Discussion forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
  • salvin francis
  • Frits Walraven
  • Piet Souris

Calling js function in ICEFaces

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i have a problem.
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.

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
Saloon Keeper
Posts: 22984
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • 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.

Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic