Kittrick Posted March 29, 2002 Posted March 29, 2002 Does anyone know of any books or anyplace on the internet that would show of any examples of how javaScript and CDML work together?? What I'm trying to do is this: I'm building a real-time sign-in system to where when a student checks into the tutoring center it counts the time that student was with a tutor and after 20 minutes it turns their last name red to show that their time is up. I've tried a timing script in FM. It worked, but it resets every time the sign-in program refreshes itself (every 5 seconds). Also it didn't work well with other scripts. It was a HUGE waste of computer resources. I know I need a JavaScript Clock (which I have courtesy of JavaScriptKit.com). Has anyone does this or could give guidance as to the right direction?? Thanks!
Anatoli Posted March 29, 2002 Posted March 29, 2002 Scripts and Web is not happy marriage. Especially the long one! You do not have to combine JS and CDML. Just use another color for the name changed by JS clock.
Garry Claridge Posted March 29, 2002 Posted March 29, 2002 Do you mean that when a student 'signs-in' that page on the browser remain open. Or, is the 'sign-in' time logged to the database and the 20mins is 'watched' from there? If you keep the 'signed-in' page on the browser JS can keep track of the time and change a colour when the time is up. It could even write a 'flag' back to the database. All the best. Garry
Kittrick Posted April 1, 2002 Author Posted April 1, 2002 Hi Garry quote: Do you mean that when a student 'signs-in' that page on the browser remain open? Yes. The browser remains open and on the same page that refreshes itself every 5 seconds with the status of all the other students that have signed in. quote: Or, is the 'sign-in' time logged to the database and the 20mins is 'watched' from there? This happens as well. I have a seperate calculation that simply subtracts the end time from the start time after the end time is logged in. My problem is how to get the text to turn red after 20 minuets to let people know that their tutoring session is up. It has to be done in Javascript because a timing script in FM is not possible. Especially due to the fact that we have many students signed in at once and the script couldn't handle that plus being refreshed every 5 seconds due to the web page refresh. Thanks for your insight!
Garry Claridge Posted April 1, 2002 Posted April 1, 2002 Edward, The Javascript function to look at, is 'setTimeout()', it uses milliseconds. It will be able to call a function to change the colour of a style-sheet object. Later today I may have a chance to write an example. All the best. Garry
Kittrick Posted April 1, 2002 Author Posted April 1, 2002 Thank you very much for pointing me in the right direction. I'm going to go pick up a JavaScript book tonight as well. Thanks!
Anatoli Posted April 1, 2002 Posted April 1, 2002 IMHO 5 seconds refresh is way too fast. If you have 10 visitors it will amount to 2 transaction per second. Depending on HW and complexity of query it may overload your FM server.
Kittrick Posted April 2, 2002 Author Posted April 2, 2002 Hi Anatoli, I will only have a max amount of visitors of 6 at any one time. Not all six visitors will be on all at the same time simultaneously (well it's only happened once). I've been concerned about the databse being overloaded by requests too...that's why I was going to run it and see what happens before I implement it just to make sure.
Recommended Posts
This topic is 8341 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now