quote:
Originally posted by chrisb
function OnEvent_Timer("getTweets") {
Messenger.MyPersonalMessage = Math.random();
}
Why is that not working?
A function definition has the following form:
js code:
function functionName(paramName1, paramName2) {
// code goes here
}
The error in your code is that you're giving a
value instead of a
variable name where your parameters go. This is faulty programming logic and therefore invalid JScript and should be corrected like so:
js code:
function OnEvent_Timer(timerID) {
if(timerID === "getTweets") {
Messenger.MyPersonalMessage = Math.random();
}
}
- The function receives its parameters and assigns the first parameter value to the variable "timerID".
- The "timerID" is checked against a string, to verify we're handling the right timer.
- When the "timerID" is checked, the personal message is set.
For more information, visit W3Schools - JavaScript functions.