Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling js function in ICEFaces  RSS feed

 
Rajeshwar Tripathi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE 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.

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!